mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-29 04:53:33 +01:00
Adding tests and changing how toWebviewResource works
- Allow placeholders in the webviewEndpoint. This is required to support serving each webview from its own origin - Add tests for toWebviewResource
This commit is contained in:
@@ -13,12 +13,12 @@ export interface WebviewInitData {
|
||||
|
||||
export function toWebviewResource(
|
||||
initData: WebviewInitData,
|
||||
uuid: string,
|
||||
resource: vscode.Uri
|
||||
): vscode.Uri {
|
||||
const rootUri = URI.parse(initData.webviewResourceRoot);
|
||||
return rootUri.with({
|
||||
path: rootUri.path + resource.path,
|
||||
query: resource.query,
|
||||
fragment: resource.fragment,
|
||||
});
|
||||
const uri = initData.webviewResourceRoot
|
||||
.replace('{{resource}}', resource.toString().replace(/^\S+?:/, ''))
|
||||
.replace('{{uuid}}', uuid);
|
||||
|
||||
return URI.parse(uri);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user