Skip to content

Commit

Permalink
fix upload permissions introduced in raik:ufs 0.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego committed Dec 21, 2015
1 parent 2797531 commit 1a3796f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/fileUpload.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,11 @@ if UploadFS?
token = cookie.get('rc_token', rawCookies) if rawCookies?

unless uid and token and RocketChat.models.Users.findOneByIdAndLoginToken(uid, token)
res.statusCode = 403
res.end('Not Allowed')
# Just to abort the request
# See https://github.com/jalik/jalik-ufs/issues/28
throw new Meteor.Error 403, 'Not Allowed'
res.writeHead 403
return false

res.setHeader 'content-disposition', "attachment; filename=\"#{ encodeURIComponent(file.name) }\""
return true

Meteor.startup ->
if Meteor.isServer
Expand Down

0 comments on commit 1a3796f

Please sign in to comment.