firebase / firebase/firebase-tools-ui

Firestore: Percent encoded document ID's crash the UI

Open
#665 1 comment 3 reactions 0 assignees View on GitHub
bug internal-bug-filed
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:
![image](https://user-images.githubusercontent.com/5959983/143962872-da78c4b1-b4ea-41b3-9aa7-6e773ba6250f.png)

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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.