File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -164,9 +164,17 @@ Future<void> copyDir(String from, String to) async {
164164}
165165
166166Future <String > getVersionListing (String package, {Uri ? pubHostedUrl}) async {
167- final url = (pubHostedUrl ?? Uri .parse ('https://pub.dartlang.org' )).resolve (
168- '/api/packages/$package ' ,
169- );
167+ var url = (pubHostedUrl ?? Uri .parse ('https://pub.dartlang.org' ))
168+ .normalizePath ();
169+ // If we have a path of only '/'
170+ if (url.path == '/' ) {
171+ url = url.replace (path: '' );
172+ }
173+ // If there is a path, and it doesn't end in a slash we normalize to slash
174+ if (url.path.isNotEmpty && ! url.path.endsWith ('/' )) {
175+ url = url.replace (path: '${url .path }/' );
176+ }
177+ url = url.resolve ('api/packages/$package ' );
170178 log.fine ('Downloading: $url ' );
171179
172180 return await retry (
You can’t perform that action at this time.
0 commit comments