Skip to content

Commit fbb32e7

Browse files
authored
Storage: Do not throw for path containing ".." (#5315)
1 parent d0710d5 commit fbb32e7

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

.changeset/big-lobsters-tell.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/storage': patch
3+
---
4+
5+
Change `ref()` to not throw if given a path with '..' in it.

packages/storage/src/service.ts

-3
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ function refFromPath(
7474
} else {
7575
// ref is a Reference
7676
if (path !== undefined) {
77-
if (path.includes('..')) {
78-
throw invalidArgument('`path` param cannot contain ".."');
79-
}
8077
return _getChild(ref, path);
8178
} else {
8279
return ref;

packages/storage/test/unit/service.exp.test.ts

-6
Original file line numberDiff line numberDiff line change
@@ -372,12 +372,6 @@ GOOG4-RSA-SHA256`
372372
const newRef = ref(reference);
373373
expect(newRef.toString()).to.equal('gs://bucket/object');
374374
});
375-
it('Throws calling ref(reference, path) if path contains ".."', () => {
376-
const error = testShared.assertThrows(() => {
377-
ref(reference, `../child/path`);
378-
}, 'storage/invalid-argument');
379-
expect(error.message).to.match(/"\.\."/);
380-
});
381375
});
382376

383377
describe('Deletion', () => {

0 commit comments

Comments
 (0)