fix: only allow png/jpg/bmp in cover/profile images

This commit is contained in:
Barış Soner Uşaklı
2019-09-21 23:10:49 -04:00
parent 5505628c8d
commit 96ab8d05aa
5 changed files with 76 additions and 46 deletions

View File

@@ -111,7 +111,7 @@ groupsController.members = async function (req, res, next) {
};
groupsController.uploadCover = async function (req, res, next) {
var params = JSON.parse(req.body.params);
const params = JSON.parse(req.body.params);
try {
const isOwner = await groups.ownership.isOwner(req.uid, params.groupName);
@@ -119,7 +119,7 @@ groupsController.uploadCover = async function (req, res, next) {
throw new Error('[[error:no-privileges]]');
}
const image = await groups.updateCover(req.uid, {
file: req.files.files[0].path,
file: req.files.files[0],
groupName: params.groupName,
});
res.json([{ url: image.url }]);