aboutsummaryrefslogtreecommitdiff
path: root/src/api/routes
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/routes')
-rw-r--r--src/api/routes/admin/statsGET.js2
-rw-r--r--src/api/routes/uploads/uploadPOST.js6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/api/routes/admin/statsGET.js b/src/api/routes/admin/statsGET.js
index 8e53529..388d4fa 100644
--- a/src/api/routes/admin/statsGET.js
+++ b/src/api/routes/admin/statsGET.js
@@ -1,6 +1,4 @@
const Route = require('../../structures/Route');
-const Util = require('../../utils/Util');
-
const StatsGenerator = require('../../utils/StatsGenerator');
// Thank you Bobby for the stats code https://github.com/BobbyWibowo/lolisafe/blob/safe.fiery.me/controllers/utilsController.js
diff --git a/src/api/routes/uploads/uploadPOST.js b/src/api/routes/uploads/uploadPOST.js
index 8e26079..a0dba27 100644
--- a/src/api/routes/uploads/uploadPOST.js
+++ b/src/api/routes/uploads/uploadPOST.js
@@ -160,7 +160,7 @@ const uploadFile = async (req, res) => {
const infoMap = req.files.map(file => ({
path: path.join(uploadDir, file.filename),
- data: file
+ data: { ...file, mimetype: Util.getMimeFromType(file.fileType) || file.mimetype || '' }
}));
return infoMap[0];
@@ -189,6 +189,8 @@ const finishChunks = async req => {
*/
file.extname = typeof file.original === 'string' ? Util.getExtension(file.original) : '';
+ file.fileType = chunksData[file.uuid].fileType;
+ file.mimetype = Util.getMimeFromType(chunksData[file.uuid].fileType) || file.mimetype || '';
if (Util.isExtensionBlocked(file.extname)) {
throw `${file.extname ? `${file.extname.substr(1).toUpperCase()} files` : 'Files with no extension'} are not permitted.`; // eslint-disable-line no-throw-literal
@@ -218,7 +220,7 @@ const finishChunks = async req => {
filename: name,
originalname: file.original || '',
extname: file.extname,
- mimetype: file.type || '',
+ mimetype: file.mimetype,
size: file.size,
hash
};