Crashing the osjs when uploading a file in osjs mountpoint
maryam4s26 opened this issue · 3 comments
maryam4s26 commented
hi.
when I upgrade node version to 16 and upload the file in osjs mountpoint, osjs crashes. How can I fix this?
maryam4s26 commented
I think we should handle the error in this way so that it does not crash:
https://github.com/os-js/osjs-server/blob/master/src/utils/vfs.js#L71
Change from code 1 to 2:
return isStream
? req.files.upload
: fs.createReadStream(req.files.upload.path);
return isStream
? req.files.upload
: fs.createReadStream(req.files.upload.path)
.on('error', function(err) {})
andersevenrud commented
Thanks for reporting! 👍
I'm away because of the holidays, so I cannot look into this myself at the moment.
Feel free to submit a PR to the osjs-server repository if you have a working solution. This is probably also something that could use a unit test to verify the problem and the solution.
andersevenrud commented
Just published @osjs/server@3.4.0
that includes the fix.