mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
fix: only allow png/jpg/bmp in cover/profile images
This commit is contained in:
@@ -1296,7 +1296,10 @@ describe('Groups', function () {
|
||||
it('should upload group cover image from file', function (done) {
|
||||
var data = {
|
||||
groupName: 'Test',
|
||||
file: imagePath,
|
||||
file: {
|
||||
path: imagePath,
|
||||
type: 'image/png',
|
||||
},
|
||||
};
|
||||
socketGroups.cover.update({ uid: adminUid }, data, function (err, data) {
|
||||
assert.ifError(err);
|
||||
@@ -1328,6 +1331,17 @@ describe('Groups', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('should fail to upload group cover with invalid image', function (done) {
|
||||
var data = {
|
||||
groupName: 'Test',
|
||||
imageData: 'data:image/svg;base64,iVBORw0KGgoAAAANSUhEUgAAABwA',
|
||||
};
|
||||
socketGroups.cover.update({ uid: adminUid }, data, function (err, data) {
|
||||
assert.equal(err.message, '[[error:invalid-image]]');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should update group cover position', function (done) {
|
||||
var data = {
|
||||
groupName: 'Test',
|
||||
|
||||
Reference in New Issue
Block a user