mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-27 17:11:14 +01:00
Merge branch 'master' into develop
This commit is contained in:
4
test/files/dirty.svg
Normal file
4
test/files/dirty.svg
Normal file
@@ -0,0 +1,4 @@
|
||||
<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="10" y="10" width="80" height="80" fill="red" stroke="black" stroke-width="4"/>
|
||||
</svg>
|
||||
<script>alert('foo');</script>
|
||||
|
After Width: | Height: | Size: 192 B |
@@ -338,6 +338,15 @@ describe('Upload Controllers', () => {
|
||||
assert.equal(body[0].url, `${nconf.get('relative_path')}/assets/uploads/category/category-1.png`);
|
||||
});
|
||||
|
||||
it('should upload svg as category image after cleaning it up', async () => {
|
||||
const { response, body } = await helpers.uploadFile(`${nconf.get('url')}/api/admin/category/uploadpicture`, path.join(__dirname, '../test/files/dirty.svg'), { params: JSON.stringify({ cid: cid }) }, jar, csrf_token);
|
||||
assert.equal(response.statusCode, 200);
|
||||
assert(Array.isArray(body));
|
||||
assert.equal(body[0].url, `${nconf.get('relative_path')}/assets/uploads/category/category-1.svg`);
|
||||
const svgContents = await fs.readFile(path.join(__dirname, '../test/uploads/category/category-1.svg'), 'utf-8');
|
||||
assert.strictEqual(svgContents.includes('<script>'), false);
|
||||
});
|
||||
|
||||
it('should upload default avatar', async () => {
|
||||
const { response, body } = await helpers.uploadFile(`${nconf.get('url')}/api/admin/uploadDefaultAvatar`, path.join(__dirname, '../test/files/test.png'), { }, jar, csrf_token);
|
||||
assert.equal(response.statusCode, 200);
|
||||
|
||||
Reference in New Issue
Block a user