tomitrescak / meteor-uploads

MIT License
295 stars 41 forks source link

validateRequest not validating request #155

Closed makertum closed 8 years ago

makertum commented 9 years ago

Not sure if using wrong or just broken on OS X 10.10.5 and Meteor 1.2.0.1

For me

UploadServer.init({
    // ..
    validateRequest:function(_request){
      return false;
    },
    // ..
});

still allows uploads and

UploadServer.init({
    // ..
    validateRequest:function(_request){
      return true;
    },
    // ..
});

results in a server error directly after uploading a file (client shows 503 service unavailable)

W20150927-18:14:32.033(2)? (STDERR) TypeError: first argument must be a string or Buffer
W20150927-18:14:32.036(2)? (STDERR)     at ServerResponse.OutgoingMessage.write (http.js:852:11)
W20150927-18:14:32.036(2)? (STDERR)     at ServerResponse.res.write (/Users/Me/.meteor/packages/webapp/.1.2.2.qij5pj++os+web.browser+web.cordova/npm/node_modules/connect/lib/middleware/compress.js:110:17)
W20150927-18:14:32.037(2)? (STDERR)     at Object.UploadServer.serve [as handle] (packages/tomi_upload-server/packages/tomi_upload-server.js:201:1)
W20150927-18:14:32.038(2)? (STDERR)     at next (/Users/Me/.meteor/packages/webapp/.1.2.2.qij5pj++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:190:15)
W20150927-18:14:32.038(2)? (STDERR)     at Function.app.handle (/Users/Me/.meteor/packages/webapp/.1.2.2.qij5pj++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:198:3)
W20150927-18:14:32.038(2)? (STDERR)     at Object.fn [as handle] (/Users/Me/.meteor/packages/webapp/.1.2.2.qij5pj++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:74:14)
W20150927-18:14:32.038(2)? (STDERR)     at next (/Users/Me/.meteor/packages/webapp/.1.2.2.qij5pj++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:190:15)
W20150927-18:14:32.038(2)? (STDERR)     at Object.WebAppInternals.staticFilesMiddleware (packages/webapp/webapp_server.js:331:1)
W20150927-18:14:32.039(2)? (STDERR)     at packages/webapp/webapp_server.js:625:1

The package is awesome though, thanks for setting it up!

tomitrescak commented 9 years ago

Uff, sorry for such a long rsponse. I have published a newere version that dealt with this issue. IO hope it resolved your prroblem.

rteslaru commented 9 years ago

I'm still experiencing the same behavior with version 1.3.2 and latest Meteor version.

giggioz commented 8 years ago

+1

tomitrescak commented 8 years ago

Guys, I promise that newest version deals with this bug. Also make sure that you return Error message in case of failed validation. I have also updated the documentation (it did not make clear that returning "false" actually means that all is good ... moronic, I know, but I have handled this as well). Please check out the whole new section on Validations.