Skip to content

Commit 88ef89a

Browse files
Support storage.cloud.google.com
1 parent 7849279 commit 88ef89a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/storage/src/implementation/location.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ export class Location {
9191
);
9292
const firebaseStorageIndices = { bucket: 1, path: 3 };
9393

94-
const cloudStorageHost = 'storage.googleapis.com';
94+
const cloudStorageHost =
95+
'(?:storage.googleapis.com|storage.cloud.google.com)';
9596
const cloudStoragePath = '([^?]*)';
9697
const cloudStorageRegExp = new RegExp(
9798
`^https?://${cloudStorageHost}/${bucketDomain}/${cloudStoragePath}`,

packages/storage/test/service.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,12 @@ GOOG4-RSA-SHA256`
195195
);
196196
assert.equal(ref.toString(), 'gs://mybucket/path with space/image.png');
197197
});
198+
it('Works with storage.cloud.google.com URLs', () => {
199+
const ref = service.refFromURL(
200+
`https://storage.cloud.google.com/mybucket/path%20with%20space/image.png`
201+
);
202+
assert.equal(ref.toString(), 'gs://mybucket/path with space/image.png');
203+
});
198204
});
199205
describe('Argument verification', () => {
200206
const service = new Service(

0 commit comments

Comments
 (0)