node-s3-uploader icon indicating copy to clipboard operation
node-s3-uploader copied to clipboard

File type .xcf (GIMP file) causing uncatchable error

Open georgezhang opened this issue 7 years ago • 1 comments

When resize and upload a file .xcf it can crash the nodejs process as error below. The problem is due to imagemagick generated multple files for individual layers after resized .xcf . The file name with suffix -n.jpg unmatched with the version path in _upload function. fs.createReadStream(version.path) emitted error not catchable inside aws-sdk.

events.js:141 throw er; // Unhandled 'error' event ^

Error: ENOENT: no such file or directory, open 'uploads/92c4fce2-e7f0-4ff7-8e3c-9245e3f7ea26/arrow_4_xxl-thumb1.jpg' at Error (native)

[nodemon] app crashed - waiting for file changes before starting...

Temporary fix suggestion (validate the existence of version.path):

Image.prototype._upload = function _upload(dest, version, cb) { fs.stat(version.path, function (err_file) { if (err_file) return cb(err_file); ...... }); };

georgezhang avatar Sep 19 '16 16:09 georgezhang

@georgezhang If you have a solution for this problem, feel free to publish a pull request.

anthonyringoet avatar Sep 20 '16 06:09 anthonyringoet