Skip to content

Commit f93c9bc

Browse files
Review
1 parent 88ef89a commit f93c9bc

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/storage/src/implementation/location.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class Location {
9393

9494
const cloudStorageHost =
9595
'(?:storage.googleapis.com|storage.cloud.google.com)';
96-
const cloudStoragePath = '([^?]*)';
96+
const cloudStoragePath = '([^?#]*)';
9797
const cloudStorageRegExp = new RegExp(
9898
`^https?://${cloudStorageHost}/${bucketDomain}/${cloudStoragePath}`,
9999
'i'

packages/storage/test/service.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ GOOG4-RSA-SHA256`
201201
);
202202
assert.equal(ref.toString(), 'gs://mybucket/path with space/image.png');
203203
});
204+
it('Works with storage.cloud.google.com URLs and escaped slash', () => {
205+
const ref = service.refFromURL(
206+
`https://storage.cloud.google.com/mybucket/path%20with%20space%2Fimage.png`
207+
);
208+
assert.equal(ref.toString(), 'gs://mybucket/path with space/image.png');
209+
});
204210
});
205211
describe('Argument verification', () => {
206212
const service = new Service(

0 commit comments

Comments
 (0)