aboutsummaryrefslogtreecommitdiff
path: root/src/api/utils/multerStorage.js
diff options
context:
space:
mode:
authorZephyrrus <[email protected]>2021-01-05 00:25:53 +0200
committerZephyrrus <[email protected]>2021-01-07 10:47:16 +0200
commit53f5015c99b3040e955632525bde4ad70250af9a (patch)
treee07e259351e7bfe2e9a07ac7bba4fab3db4ed736 /src/api/utils/multerStorage.js
parentfix: normalize url and thumbnail response (diff)
downloadhost.fuwn.me-53f5015c99b3040e955632525bde4ad70250af9a.tar.xz
host.fuwn.me-53f5015c99b3040e955632525bde4ad70250af9a.zip
feat: check for real mimetype using file-type
For now, if file-type returns undefined, we take the value from the browser. In the future this should be removed to ensure people can't bypass the real mime checking using a special file that can't be recognized by file-type.
Diffstat (limited to 'src/api/utils/multerStorage.js')
-rw-r--r--src/api/utils/multerStorage.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/api/utils/multerStorage.js b/src/api/utils/multerStorage.js
index a2d01a4..9c4d94f 100644
--- a/src/api/utils/multerStorage.js
+++ b/src/api/utils/multerStorage.js
@@ -8,7 +8,7 @@ function DiskStorage(opts) {
if (typeof opts.destination === 'string') {
jetpack.dir(opts.destination);
- this.getDestination = function($0, $1, cb) { cb(null, opts.destination); };
+ this.getDestination = ($0, $1, cb) => { cb(null, opts.destination); };
} else {
this.getDestination = opts.destination;
}
@@ -86,6 +86,4 @@ DiskStorage.prototype._removeFile = function _removeFile(req, file, cb) {
fs.unlink(path, cb);
};
-module.exports = function(opts) {
- return new DiskStorage(opts);
-};
+module.exports = opts => new DiskStorage(opts);