Fix csp for CDN extension locations

This rule needs to end in a `/` so that all files under the extension are allowed
This commit is contained in:
Matt Bierner
2021-10-15 14:12:31 -07:00
parent fa1e1fa701
commit b85a272298

View File

@@ -78,7 +78,12 @@ export class ExtHostWebview implements vscode.Webview {
if (extensionLocation.scheme === Schemas.https || extensionLocation.scheme === Schemas.http) {
// The extension is being served up from a CDN.
// Also include the CDN in the default csp.
return extensionLocation + ' ' + webviewGenericCspSource;
let extensionCspRule = extensionLocation.toString();
if (!extensionCspRule.endsWith('/')) {
// Always treat the location as a directory so that we allow all content under it
extensionCspRule += '/';
}
return extensionCspRule + ' ' + webviewGenericCspSource;
}
return webviewGenericCspSource;
}