Potential Issue with destination Parameter Type in Multer Custom Storage
- Dominant language
- JavaScript
- Stars
- 12.1k
- Forks
- 1.1k
- Avg merge
- 8d 2h
- Merged PRs (30d)
- 21
Description
in this file https://github.com/expressjs/multer/blob/master/StorageEngine.md
its giving a template for making a custom storage engine but there is a problem I guess..
```js
function MyCustomStorage (opts) {
this.getDestination = (opts.destination || getDestination)
}
function MyCustomStorage (opts) {
this.getDestination = (opts.destination || getDestination)
}
MyCustomStorage.prototype._handleFile = function _handleFile (req, file, cb) {
this.getDestination(req, file, function (err, path) {
if (err) return cb(err)
var outStream = fs.createWriteStream(path)
file.stream.pipe(outStream)
outStream.on('error', cb)
outStream.on('finish', function () {
cb(null, {
path: path,
size: outStream.bytesWritten
})
})
})
}
```
its calling `this.getDestination` as function but it may not be a function if user provided "destination property" in the constructor.. or I am getting this wrong?
_Edited by Ulises to highlight syntax_
Contributor guide
Assessment
This issue has not been assessed yet.