File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -1071,17 +1071,15 @@ class TarballStorageNamer {
10711071 (namespace == null || namespace.isEmpty) ? '' : 'ns/$namespace /' ;
10721072
10731073 /// The GCS object name of a tarball object - excluding leading '/'.
1074- String tarballObjectName (String package, String version)
1075- // TODO: Do we need some kind of escaping here?
1076- =>
1074+ String tarballObjectName (String package, String version) =>
10771075 '${prefix }packages/$package -$version .tar.gz' ;
10781076
10791077 /// The GCS object name of an temporary object [guid] - excluding leading '/'.
10801078 String tmpObjectName (String guid) => 'tmp/$guid ' ;
10811079
10821080 /// The http URL of a publicly accessable GCS object.
10831081 String tarballObjectUrl (String package, String version) {
1084- final object = tarballObjectName (package, version);
1082+ final object = tarballObjectName (package, Uri . encodeComponent ( version) );
10851083 return '$storageBaseUrl /$bucket /$object ' ;
10861084 }
10871085}
Original file line number Diff line number Diff line change @@ -159,10 +159,18 @@ void main() {
159159 });
160160 });
161161
162- testWithServices ('Backend.downloadUrl' , () async {
163- final url = await backend.downloadUrl ('hydrogen' , '2.0.8' );
164- expect (url.toString (),
165- 'http://localhost:0/fake-bucket-pub/packages/hydrogen-2.0.8.tar.gz' );
162+ group ('Backend.downloadUrl' , () {
163+ testWithServices ('no escape needed' , () async {
164+ final url = await backend.downloadUrl ('hydrogen' , '2.0.8' );
165+ expect (url.toString (),
166+ 'http://localhost:0/fake-bucket-pub/packages/hydrogen-2.0.8.tar.gz' );
167+ });
168+
169+ testWithServices ('version escape needed' , () async {
170+ final url = await backend.downloadUrl ('hydrogen' , '2.0.8+5' );
171+ expect (url.toString (),
172+ 'http://localhost:0/fake-bucket-pub/packages/hydrogen-2.0.8%2B5.tar.gz' );
173+ });
166174 });
167175 });
168176
You can’t perform that action at this time.
0 commit comments