prevent svg icons
This commit is contained in:
parent
7cee28578b
commit
e0dff61012
2 changed files with 20 additions and 0 deletions
|
@ -502,6 +502,10 @@ export function validateManifest(manifest: Manifest): Manifest {
|
||||||
|
|
||||||
validateEngineCompatibility(manifest.engines['vscode']);
|
validateEngineCompatibility(manifest.engines['vscode']);
|
||||||
|
|
||||||
|
if (/\.svg$/i.test(manifest.icon || '')) {
|
||||||
|
throw new Error(`SVGs can't be used as icons: ${manifest.icon}`);
|
||||||
|
}
|
||||||
|
|
||||||
return manifest;
|
return manifest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,17 @@ function assertMissingProperty(manifest: XMLManifest, name: string): void {
|
||||||
assert.equal(property.length, 0, `Property '${name}' should not exist`);
|
assert.equal(property.length, 0, `Property '${name}' should not exist`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createManifest(extra: Partial<Manifest>): Manifest {
|
||||||
|
return {
|
||||||
|
name: 'test',
|
||||||
|
publisher: 'mocha',
|
||||||
|
version: '0.0.1',
|
||||||
|
description: 'test extension',
|
||||||
|
engines: { vscode: '*' },
|
||||||
|
...extra
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
describe('collect', () => {
|
describe('collect', () => {
|
||||||
|
|
||||||
it('should catch all files', () => {
|
it('should catch all files', () => {
|
||||||
|
@ -192,6 +203,11 @@ describe('validateManifest', () => {
|
||||||
assert.throws(() => { validateManifest({ publisher: 'demo', name: 'demo', version: '1.0.0', engines: null }); });
|
assert.throws(() => { validateManifest({ publisher: 'demo', name: 'demo', version: '1.0.0', engines: null }); });
|
||||||
assert.throws(() => { validateManifest({ publisher: 'demo', name: 'demo', version: '1.0.0', engines: { vscode: null } }); });
|
assert.throws(() => { validateManifest({ publisher: 'demo', name: 'demo', version: '1.0.0', engines: { vscode: null } }); });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should prevent SVG icons', () => {
|
||||||
|
assert(validateManifest(createManifest({ icon: 'icon.png' })));
|
||||||
|
assert.throws(() => { validateManifest(createManifest({ icon: 'icon.svg' })); });
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('toVsixManifest', () => {
|
describe('toVsixManifest', () => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue