firebase / firebase/firebase-tools-ui
Firestore: Percent encoded document ID's crash the UI
- Dominant language
- TypeScript
- Stars
- 291
- Forks
- 74
- PR merge metrics
- No merged PRs in 30d
Description
Hi, hope this is the right repo to be posting in!
First off, the emulators are an absolute joy to use.
However, my team has encountered an issue where we want to create documents that use a url as the document id.
While this works just fine in the production firebase firestore console, it unfortunately causes a crash when using the Firestore UI with the Firestore emulator... Presumably some piece of logic involved in parsing window.location explodes when % characters are present in it.
What we're trying to do, e.g.:
const encodedString = encodeURIComponent(`https://googleapis.dev/python/storage/latest/buckets.html`)
-> 'https%3A%2F%2Fgoogleapis.dev%2Fpython%2Fstorage%2Flatest%2Fbuckets.html'
If you take that encoded string and create a document with it as the document id, you will get the following error:

Without looking at the code, my suspicion is there is a split join (or split pop) being used to separate out the components of the firestore path's hierarchy and after all elements of the split are joined, you end up with some string that has `//` in it.
For robustness, try other strings containing %'s, like `A%A` etc... they cause different errors sometimes, but all crash the application. The emulator itself looks like it handles these fine :)
Contributor guide
Assessment
This issue has not been assessed yet.