Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't compatible with multer #85

Open
xueenda opened this issue Feb 5, 2015 · 1 comment
Open

Doesn't compatible with multer #85

xueenda opened this issue Feb 5, 2015 · 1 comment

Comments

@xueenda
Copy link

xueenda commented Feb 5, 2015

Please fix.

The file uploaded with multer has the following json object:

{ fieldname: 'avatar_image',
originalname: 'blob',
name: '1897942a7e194802e27db8e71c7a0fd4',
encoding: '7bit',
mimetype: 'image/jpeg',
path: '/var/folders/m8/x6wjwggd7sl4qv01sb_1r6gc0000gr/T/1897942a7e194802e27db8e71c7a0fd4',
extension: '',
size: 12934,
truncated: false,
buffer: null }

The object is different from the old express file upload.

Here is the error:
/Users/endaxue/workspace/profile/node_modules/imager/lib/imager.js:843
return (file['type'] || file['mimetype']) || file.headers['content-type'];
^
TypeError: Cannot read property 'content-type' of undefined
at getFileType (/Users/endaxue/workspace/profile/node_modules/imager/lib/imager.js:843:60)
at prepare (/Users/endaxue/workspace/profile/node_modules/imager/lib/imager.js:122:18)
at /Users/endaxue/workspace/profile/node_modules/imager/node_modules/async/lib/async.js:111:13
at Array.forEach (native)
at _each (/Users/endaxue/workspace/profile/node_modules/imager/node_modules/async/lib/async.js:32:24)
at Object.async.each (/Users/endaxue/workspace/profile/node_modules/imager/node_modules/async/lib/async.js:110:9)
at /Users/endaxue/workspace/profile/node_modules/imager/lib/imager.js:134:13
at /Users/endaxue/workspace/profile/node_modules/imager/node_modules/async/lib/async.js:232:13
at /Users/endaxue/workspace/profile/node_modules/imager/node_modules/async/lib/async.js:119:25
at /Users/endaxue/workspace/profile/node_modules/imager/node_modules/async/lib/async.js:24:16

@xueenda
Copy link
Author

xueenda commented Feb 5, 2015

/node_modules/imager/lib/imager.js
line 834 change to
type: typeof(file) == 'string' ? mime.lookup(file) : file.type || file.mimetype,

will fix the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant