dmitriy-nz / nestjs-form-data

NestJS middleware for handling multipart/form-data, which is primarily used for uploading files.
https://www.npmjs.com/package/nestjs-form-data
MIT License
125 stars 25 forks source link

File name bug 🐛 #5

Closed CorneilleEdi closed 3 years ago

CorneilleEdi commented 3 years ago

I have encountered a bug.

originalName is supposed to give the original name of the file but it is not working. The file name is retrieved with the filename key.

With the actual code, console.log(image) gives

MemoryStoredFile {
  filename: 'apple.jpg',
  encoding: '7bit',
  mimetype: 'image/jpeg',
  buffer: ....,
  size: 175022
}

The file name is accessible by calling image.filename not image.originalName like in the type definition. image.originalName returns undefined.

I think that it is a bug. To solve it, I've created a pull request. #4 The pull request now gives

MemoryStoredFile {
  originalName: 'apple.jpg',
  encoding: '7bit',
  mimetype: 'image/jpeg',
  buffer: ....,
  size: 175022
}

Breaking change: no more filename

dmitriy-nz commented 3 years ago

Hey! Good job, your PR merged and Included in version 1.4.3