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 {
158
158
}
159
159
try {
160
160
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
+ }
161
172
if (uri.path.endsWith ('/ws' )) {
162
- return 'ws://${uri .authority }${ uri . path } ' ;
173
+ return 'ws://${uri .authority }$path ' ;
163
174
}
164
- return 'ws://${uri .authority }${ uri . path } /ws' ;
175
+ return 'ws://${uri .authority }$path /ws' ;
165
176
} catch (e) {
166
177
print ('caught exception with: $networkAddress -- $e ' );
167
178
return networkAddress;
You can’t perform that action at this time.
0 commit comments