File tree 2 files changed +5
-11
lines changed
lib/vscode/src/vs/workbench
contrib/webview/browser/pre
2 files changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -55,18 +55,12 @@ export function asWebviewUri(
55
55
} ) ;
56
56
}
57
57
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
64
- const [ host , port ] = resource . authority . split ( ':' , 2 )
65
- const authority = `${ resource . scheme } +${ host } .${ webviewRootResourceAuthority } ${ port ? `:${ port } ` : '' } ` ;
66
- console . log ( `show me the authority: ${ authority } ` ) ;
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 uri = new URL ( resource . authority ) ;
67
61
return URI . from ( {
68
62
scheme : Schemas . https ,
69
- authority,
63
+ authority : ` ${ resource . scheme } + ${ uri . hostname } + ${ uri . port } . ${ webviewRootResourceAuthority } ` ,
70
64
path : resource . path ,
71
65
fragment : resource . fragment ,
72
66
query : resource . query ,
Original file line number Diff line number Diff line change @@ -256,7 +256,7 @@ async function processResourceRequest(event, requestUrl) {
256
256
257
257
const firstHostSegment = requestUrl . hostname . slice ( 0 , requestUrl . hostname . length - ( resourceBaseAuthority . length + 1 ) ) ;
258
258
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 ) + port ? ( ":" + port ) : ""
260
260
261
261
for ( const parentClient of parentClients ) {
262
262
parentClient . postMessage ( {
You can’t perform that action at this time.
0 commit comments