Another asWebviewUri fix, use the authority of the root that we found the file in.

This commit is contained in:
Rob Lourens 2021-04-27 10:06:34 -07:00
parent c193a1ca38
commit 19cda32aaf
4 changed files with 7 additions and 7 deletions

View file

@ -1158,7 +1158,7 @@ var requirejs = (function() {
allowMultipleAPIAcquire: true,
allowScripts: true,
localResourceRoots: this.localResourceRootsCache,
alwaysFetchFromRemote: true
useRootAuthority: true
}, undefined);
let resolveFunc: () => void;

View file

@ -485,7 +485,7 @@ export abstract class BaseWebview<T extends HTMLElement> extends Disposable {
extensionLocation: this.extension?.location,
roots: this.content.options.localResourceRoots || [],
remoteConnectionData,
useRemoteAuthority: this.content.options.alwaysFetchFromRemote ? remoteAuthority : undefined
useRootAuthority: this.content.options.useRootAuthority
}, this._fileService, this._requestService, this._logService, this._resourceLoadingCts.token);
switch (result.type) {

View file

@ -50,7 +50,7 @@ export async function loadLocalResource(
extensionLocation: URI | undefined;
roots: ReadonlyArray<URI>;
remoteConnectionData?: IRemoteConnectionData | null;
useRemoteAuthority?: string;
useRootAuthority?: boolean;
},
fileService: IFileService,
requestService: IRequestService,
@ -59,7 +59,7 @@ export async function loadLocalResource(
): Promise<WebviewResourceResponse.StreamResponse> {
logService.debug(`loadLocalResource - being. requestUri=${requestUri}`);
const resourceToLoad = getResourceToLoad(requestUri, options.roots, options.extensionLocation, options.useRemoteAuthority);
const resourceToLoad = getResourceToLoad(requestUri, options.roots, options.extensionLocation, options.useRootAuthority);
logService.debug(`loadLocalResource - found resource to load. requestUri=${requestUri}, resourceToLoad=${resourceToLoad}`);
@ -119,11 +119,11 @@ function getResourceToLoad(
requestUri: URI,
roots: ReadonlyArray<URI>,
extensionLocation: URI | undefined,
useRemoteAuthority: string | undefined
useRootAuthority: boolean | undefined
): URI | undefined {
for (const root of roots) {
if (containsResource(root, requestUri)) {
return normalizeResourcePath(requestUri, extensionLocation, useRemoteAuthority);
return normalizeResourcePath(requestUri, extensionLocation, useRootAuthority ? root.authority : undefined);
}
}

View file

@ -80,7 +80,7 @@ export interface WebviewOptions {
}
export interface WebviewContentOptions {
readonly alwaysFetchFromRemote?: boolean;
readonly useRootAuthority?: boolean;
readonly allowMultipleAPIAcquire?: boolean;
readonly allowScripts?: boolean;
readonly localResourceRoots?: ReadonlyArray<URI>;