mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-02-16 14:24:40 +00:00
Fix CSP tests by filtering out empty array fields
In 25f5fd2a the `media-src`, `child-src` and `connect-src` settings were removed, as they are filled with the `default-src` automatically. This caused a bug in the test code, as it now tried to access a nonexistent field of `unextendedCSP`. This commit adds a filter that removes the empty array field before converting to a string. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
2ac89d3334
commit
6760739761
1 changed files with 1 additions and 1 deletions
|
@ -144,7 +144,7 @@ describe('Content security policies', function () {
|
|||
const variations = ['default', 'script', 'img', 'style', 'font', 'object', 'media', 'child', 'connect']
|
||||
|
||||
for (let i = 0; i < variations.length; i++) {
|
||||
assert.strictEqual(csp.computeDirectives()[variations[i] + 'Src'].toString(), ['https://' + variations[i] + '.example.com'].concat(unextendedCSP[variations[i] + 'Src']).toString())
|
||||
assert.strictEqual(csp.computeDirectives()[variations[i] + 'Src'].toString(), ['https://' + variations[i] + '.example.com'].concat(unextendedCSP[variations[i] + 'Src']).filter(x => x != null).toString())
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue