File tree 2 files changed +14
-8
lines changed
2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -1071,17 +1071,15 @@ class TarballStorageNamer {
1071
1071
(namespace == null || namespace.isEmpty) ? '' : 'ns/$namespace /' ;
1072
1072
1073
1073
/// 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) =>
1077
1075
'${prefix }packages/$package -$version .tar.gz' ;
1078
1076
1079
1077
/// The GCS object name of an temporary object [guid] - excluding leading '/'.
1080
1078
String tmpObjectName (String guid) => 'tmp/$guid ' ;
1081
1079
1082
1080
/// The http URL of a publicly accessable GCS object.
1083
1081
String tarballObjectUrl (String package, String version) {
1084
- final object = tarballObjectName (package, version);
1082
+ final object = tarballObjectName (package, Uri . encodeComponent ( version) );
1085
1083
return '$storageBaseUrl /$bucket /$object ' ;
1086
1084
}
1087
1085
}
Original file line number Diff line number Diff line change @@ -159,10 +159,18 @@ void main() {
159
159
});
160
160
});
161
161
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
+ });
166
174
});
167
175
});
168
176
You can’t perform that action at this time.
0 commit comments