Skip to content

Commit

Permalink
Merge pull request #11 from VeliovGroup/dev_1
Browse files Browse the repository at this point in the history
v1.1.6
  • Loading branch information
dr-dimitru committed Apr 28, 2015
2 parents dac0b8d + 7682e15 commit 8dd31aa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .versions
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ [email protected]
[email protected]
[email protected]
[email protected]
ostrio:[email protected].5
ostrio:[email protected].6
ostrio:[email protected]
[email protected]
[email protected]
Expand Down
26 changes: 15 additions & 11 deletions files.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -596,15 +596,25 @@ class Meteor.Files
###
download: if Meteor.isServer then (self) ->
console.info "Meteor.Files Debugger: [download()]" if @debug
check self.currentFile, Object

if Meteor.isServer
resp = @response

if self.debug
console.info "======================|Headers for: #{self.currentFile.path}|======================"
console.info @request.headers
unless _.isObject(self.currentFile) and fs.existsSync self.currentFile.path
if self.debug
console.info "======================|404|======================"
console.info @request.headers

resp.writeHead 404,
"Content-Type": "text/plain"
resp.write "File Not Found :("
resp.end()
else

if self.debug
console.info "======================|Headers for: #{self.currentFile.path}|======================"
console.info @request.headers

if fs.existsSync self.currentFile.path
if @params.query.download and @params.query.download == 'true'
file = fs.readFileSync self.currentFile.path
resp.writeHead 200,
Expand Down Expand Up @@ -672,12 +682,6 @@ class Meteor.Files
'Content-Length': self.currentFile.size
stream.pipe resp

else
resp.writeHead 404,
"Content-Type": "text/plain"
resp.write "File Not Found :("
resp.end()

else
new Meteor.Error 500, "Can't [download()] on client!"
else
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
name: 'ostrio:files',
version: '1.1.5',
version: '1.1.6',
summary: 'Upload, Store and Download small and huge files to/from file system (FS) via DDP and HTTP',
git: 'https://github.com/VeliovGroup/Meteor-Files',
documentation: 'README.md'
Expand Down

0 comments on commit 8dd31aa

Please sign in to comment.