Skip to content

Commit 3ceb4cb

Browse files
authored
Merge 99503fb into 56f0c4e
2 parents 56f0c4e + 99503fb commit 3ceb4cb

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/vscode/src/vs/workbench/api/common/shared/webview.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ export function asWebviewUri(
5555
});
5656
}
5757

58+
// NOTE@coder: Add the port separately because if the port is in the domain the
59+
// URL will be invalid and the browser will not request it.
60+
const authorityUrl = new URL(`${resource.scheme}://${resource.authority}`);
5861
return URI.from({
5962
scheme: Schemas.https,
60-
authority: `${resource.scheme}+${resource.authority}.${webviewRootResourceAuthority}`,
63+
authority: `${resource.scheme}+${authorityUrl.hostname}.${webviewRootResourceAuthority}${authorityUrl.port ? (':' + authorityUrl.port) : ''}`,
6164
path: resource.path,
6265
fragment: resource.fragment,
6366
query: resource.query,

lib/vscode/src/vs/workbench/contrib/webview/browser/pre/service-worker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ async function processResourceRequest(event, requestUrl) {
256256

257257
const firstHostSegment = requestUrl.hostname.slice(0, requestUrl.hostname.length - (resourceBaseAuthority.length + 1));
258258
const scheme = firstHostSegment.split('+', 1)[0];
259-
const authority = firstHostSegment.slice(scheme.length + 1); // may be empty
259+
const authority = firstHostSegment.slice(scheme.length + 1) + requestUrl.port ? (':' + requestUrl.port) : ''; // may be empty
260260

261261
for (const parentClient of parentClients) {
262262
parentClient.postMessage({

0 commit comments

Comments
 (0)