File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
pkg/observatory/lib/src/elements Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -158,10 +158,21 @@ class VMConnectElement extends CustomElement implements Renderable {
158158 }
159159 try {
160160 Uri uri = Uri .parse (networkAddress);
161+ // We massage this URI in various places throughout the codebase,
162+ // sometimes rather naively. We remove any trailing '/' to normalize the
163+ // URI to avoid situations where URIs can be constructed with two
164+ // consecutive slashes which can cause authentication code checks to fail
165+ // (e.g., http://127.0.0.1:8080/oOR_LvT4RT4=//getVMTimeline).
166+ //
167+ // See https://github.com/dart-lang/sdk/issues/61091#issuecomment-3058991929
168+ var path = uri.path;
169+ if (path.endsWith ('/' )) {
170+ path = path.substring (0 , path.length - 1 );
171+ }
161172 if (uri.path.endsWith ('/ws' )) {
162- return 'ws://${uri .authority }${ uri . path } ' ;
173+ return 'ws://${uri .authority }$path ' ;
163174 }
164- return 'ws://${uri .authority }${ uri . path } /ws' ;
175+ return 'ws://${uri .authority }$path /ws' ;
165176 } catch (e) {
166177 print ('caught exception with: $networkAddress -- $e ' );
167178 return networkAddress;
You can’t perform that action at this time.
0 commit comments