Skip to content

Commit

Permalink
TypeError: Cannot set properties of undefined (setting 'filename')
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeymond committed Mar 24, 2024
1 parent 8d96e5f commit acf69f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions lib/multer-savefilesorg-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,16 @@ class MulterSaveFilesOrgStorage {
},
timeout: UPLOAD_TIMEOUT
}
).then(resp => {
req.file.filename = resp.data.fileEntry.url;
cb(null)
).then(({ data }) => {
cb(null, {
name: data.fileEntry.name,
file_name: data.fileEntry.file_name,
mime: data.fileEntry.mime,
type: data.fileEntry.type,
file_size: data.fileEntry.file_size,
extension: data.fileEntry.extension,
url: data.fileEntry.url
})
}).catch(err => {
cb(err)
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "multer-savefilesorg-storage",
"version": "1.0.1",
"version": "1.0.2",
"description": "Forward multipart/form-data file upload into a savefiles.org drive.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit acf69f7

Please sign in to comment.