File tree 1 file changed +26
-1
lines changed
src/Components/WebAssembly/Server/src
1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -366,9 +366,34 @@ private string GetDevToolsUrlWithProxy(BrowserTab tabToDebug)
366
366
{
367
367
var underlyingV8Endpoint = new Uri ( tabToDebug . WebSocketDebuggerUrl ) ;
368
368
var proxyEndpoint = new Uri ( _debugProxyUrl ) ;
369
- var devToolsUrlAbsolute = new Uri ( _browserHost + tabToDebug . DevtoolsFrontendUrl ) ;
369
+ var devToolsUrlAbsolute = new Uri ( new Uri ( _browserHost ) , relativeUri : NormalizeDevtoolsFrontendUrl ( tabToDebug . DevtoolsFrontendUrl ) ) ;
370
370
var devToolsUrlWithProxy = $ "{ devToolsUrlAbsolute . Scheme } ://{ devToolsUrlAbsolute . Authority } { devToolsUrlAbsolute . AbsolutePath } ?{ underlyingV8Endpoint . Scheme } ={ proxyEndpoint . Authority } { underlyingV8Endpoint . PathAndQuery } ";
371
371
return devToolsUrlWithProxy ;
372
+
373
+ static string NormalizeDevtoolsFrontendUrl ( string devtoolsFrontendUrl )
374
+ {
375
+ // Frontend url can be absolute or relative based on browser
376
+ string localPath ;
377
+ string queryString ;
378
+ if ( Uri . TryCreate ( devtoolsFrontendUrl , UriKind . Absolute , out var devtoolsFrontendUri ) )
379
+ {
380
+ localPath = devtoolsFrontendUri . LocalPath ;
381
+ queryString = devtoolsFrontendUri . Query ;
382
+ }
383
+ else
384
+ {
385
+ var queryStringBeginCharIndex = devtoolsFrontendUrl . IndexOf ( '?' ) ;
386
+ localPath = devtoolsFrontendUrl [ ..queryStringBeginCharIndex ] ;
387
+ queryString = devtoolsFrontendUrl [ queryStringBeginCharIndex ..] ;
388
+ }
389
+
390
+ // We need only the last segment of the path
391
+ localPath = localPath . Split ( '/' ) . Last ( ) . TrimStart ( '/' ) ;
392
+ // Ensure starts with "devtools"
393
+ localPath = $ "devtools/{ localPath } ";
394
+
395
+ return $ "{ localPath } ?{ queryString } ";
396
+ }
372
397
}
373
398
374
399
private string GetLaunchChromeInstructions ( string targetApplicationUrl )
You can’t perform that action at this time.
0 commit comments