Skip to content

Node.js based forum software built for the modern web

patching accidental leakage of full path of uploaded file when uploading pictures or attachments

Julian Lama8ec6a4a9c14
diff --git a/src/controllers/uploads.js b/src/controllers/uploads.js
index e7e77c4a4f..b14d878230 100644
--- a/src/controllers/uploads.js
+++ b/src/controllers/uploads.js
@@ -73,7 +73,14 @@ function uploadAsImage(req, uploadedFile, callback) {
resizeImage(fileObj, next);
},
- ], callback);
+ ], function (err, fileObj) {
+ if (err) {
+ return callback(err);
+ }
+
+ delete fileObj.path;
+ callback(null, fileObj);
+ });
}
function uploadAsFile(req, uploadedFile, callback) {
@@ -90,7 +97,14 @@ function uploadAsFile(req, uploadedFile, callback) {
}
uploadsController.uploadFile(req.uid, uploadedFile, next);
},
- ], callback);
+ ], function (err, fileObj) {
+ if (err) {
+ return callback(err);
+ }
+
+ delete fileObj.path;
+ callback(null, fileObj);
+ });
}
function resizeImage(fileObj, callback) {