Skip to content

Commit

Permalink
Storage: Do not throw for path containing ".." (#5315)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsubox76 committed Aug 17, 2021
1 parent d0710d5 commit fbb32e7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-lobsters-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/storage': patch
---

Change `ref()` to not throw if given a path with '..' in it.
3 changes: 0 additions & 3 deletions packages/storage/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ function refFromPath(
} else {
// ref is a Reference
if (path !== undefined) {
if (path.includes('..')) {
throw invalidArgument('`path` param cannot contain ".."');
}
return _getChild(ref, path);
} else {
return ref;
Expand Down
6 changes: 0 additions & 6 deletions packages/storage/test/unit/service.exp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,6 @@ GOOG4-RSA-SHA256`
const newRef = ref(reference);
expect(newRef.toString()).to.equal('gs://bucket/object');
});
it('Throws calling ref(reference, path) if path contains ".."', () => {
const error = testShared.assertThrows(() => {
ref(reference, `../child/path`);
}, 'storage/invalid-argument');
expect(error.message).to.match(/"\.\."/);
});
});

describe('Deletion', () => {
Expand Down

0 comments on commit fbb32e7

Please sign in to comment.