mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-22 09:38:38 +01:00
Make sure asWebviewUri also handles replacing commit
This commit is contained in:
@@ -40,7 +40,9 @@ export class ExtHostWebview implements vscode.Webview {
|
||||
}
|
||||
|
||||
public get cspSource(): string {
|
||||
return this._initData.webviewCspSource.replace('{{uuid}}', this._handle);
|
||||
return this._initData.webviewCspSource
|
||||
.replace('{{uuid}}', this._handle)
|
||||
.replace('{{commit}}', this._initData.commit || '211fa02efe8c041fd7baa8ec3dce199d5185aa44');
|
||||
}
|
||||
|
||||
public get html(): string {
|
||||
|
||||
@@ -7,6 +7,7 @@ import { URI } from 'vs/base/common/uri';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export interface WebviewInitData {
|
||||
readonly commit?: string;
|
||||
readonly webviewResourceRoot: string;
|
||||
readonly webviewCspSource: string;
|
||||
}
|
||||
@@ -14,11 +15,11 @@ export interface WebviewInitData {
|
||||
export function asWebviewUri(
|
||||
initData: WebviewInitData,
|
||||
uuid: string,
|
||||
resource: vscode.Uri
|
||||
resource: vscode.Uri,
|
||||
): vscode.Uri {
|
||||
const uri = initData.webviewResourceRoot
|
||||
.replace('{{commit}}', initData.commit || '211fa02efe8c041fd7baa8ec3dce199d5185aa44')
|
||||
.replace('{{resource}}', resource.toString().replace(/^\S+?:/, ''))
|
||||
.replace('{{uuid}}', uuid);
|
||||
|
||||
return URI.parse(uri);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user