Skip to content

Commit 6c18207

Browse files
committed
fix(lib/vscode): patch authority in asWebviewUri
We do this because resources in webviews don't load properly when the port is used in the resource uri. We're not sure why this is happening but adding this fix to get webviews working like before.
1 parent 379486a commit 6c18207

File tree

1 file changed

+7
-1
lines changed
  • lib/vscode/src/vs/workbench/api/common/shared

1 file changed

+7
-1
lines changed

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

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

58+
// NOTE@coder (@jsjoeio)
59+
// We're not exactly sure how the resource.authority is used in the URI
60+
// but we noticed resources not loading correctly when the authority
61+
// contained a port like localhost:8080.
62+
// As a temporary workaround, we split the authority at the first colon
63+
// and use the first part e.g. localhost
5864
return URI.from({
5965
scheme: Schemas.https,
60-
authority: `${resource.scheme}+${resource.authority}.${webviewRootResourceAuthority}`,
66+
authority: `${resource.scheme}+${resource.authority.split(':')[0]}.${webviewRootResourceAuthority}`,
6167
path: resource.path,
6268
fragment: resource.fragment,
6369
query: resource.query,

0 commit comments

Comments
 (0)