mirror of https://git.tuxpa.in/a/code-server.git
Merge pull request #3895 from cdr/jsjoeio-fix-webview-uri
fix(lib/vscode): patch authority in asWebviewUri
This commit is contained in:
commit
f75edc26b7
|
@ -55,9 +55,12 @@ export function asWebviewUri(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE@coder: Add the port separately because if the port is in the domain the
|
||||||
|
// URL will be invalid and the browser will not request it.
|
||||||
|
const authorityUrl = new URL(`${resource.scheme}://${resource.authority}`);
|
||||||
return URI.from({
|
return URI.from({
|
||||||
scheme: Schemas.https,
|
scheme: Schemas.https,
|
||||||
authority: `${resource.scheme}+${resource.authority}.${webviewRootResourceAuthority}`,
|
authority: `${resource.scheme}+${authorityUrl.hostname}.${webviewRootResourceAuthority}${authorityUrl.port ? (':' + authorityUrl.port) : ''}`,
|
||||||
path: resource.path,
|
path: resource.path,
|
||||||
fragment: resource.fragment,
|
fragment: resource.fragment,
|
||||||
query: resource.query,
|
query: resource.query,
|
||||||
|
|
|
@ -256,7 +256,7 @@ async function processResourceRequest(event, requestUrl) {
|
||||||
|
|
||||||
const firstHostSegment = requestUrl.hostname.slice(0, requestUrl.hostname.length - (resourceBaseAuthority.length + 1));
|
const firstHostSegment = requestUrl.hostname.slice(0, requestUrl.hostname.length - (resourceBaseAuthority.length + 1));
|
||||||
const scheme = firstHostSegment.split('+', 1)[0];
|
const scheme = firstHostSegment.split('+', 1)[0];
|
||||||
const authority = firstHostSegment.slice(scheme.length + 1); // may be empty
|
const authority = firstHostSegment.slice(scheme.length + 1) + requestUrl.port ? (':' + requestUrl.port) : ''; // may be empty
|
||||||
|
|
||||||
for (const parentClient of parentClients) {
|
for (const parentClient of parentClients) {
|
||||||
parentClient.postMessage({
|
parentClient.postMessage({
|
||||||
|
|
Loading…
Reference in New Issue