Encoded doc id, cannot open document or it's conflicts
Nervniyak opened this issue · comments
In our application we encode special characters in _id. But for some reason conflicts break the UI completely and clue to the issue can be seen in URL.
What I did is:
- Created a document with _id =
color_Yellow_2021-01-21T12%3A02%3A51.089Z
in Angular PouchDB. Then I synced it to CouchDB (no problems at this point) - Opened my application 2 times and made both of them go offline, so no continuous syncing with CouchDB present.
- I edited this
color_Yellow_2021-01-21T12%3A02%3A51.089Z
on both of the apps, producing 2 different revisions. - Synced first app with CouchDB and then second, CouchDB chose the "Server-Selected Rev" and both applications are working fine.
- Try to open the
color_Yellow_2021-01-21T12%3A02%3A51.089Z
in Fauxton UI to see conflicts and I see empty page (clicked on the doc in all documents list)
The URL is http://127.0.0.1:5984/_utils/#database/recorder_recorder/color_Yellow_2021-01-21T12%253A02%253A51.089Z
which is different from doc _id
After few tries with refreshing sometimes I manage to open the page:
But when I click on conflicts I get this
With interesting URL http://127.0.0.1:5984/_utils/#database/recorder_recorder/color_Yellow_2021-01-21T12%3A02%3A51.089Z/conflicts
that is different from the one on previous page.
And if instead of clicking I go back and manually add /conflicts
to the previous URL it loads properly:
URL is http://127.0.0.1:5984/_utils/#database/recorder_recorder/color_Yellow_2021-01-21T12%253A02%253A51.089Z/conflicts
It seems like Fauxton tries to do some encoding/decoding and fails producing broken URLs that lead to nowhere.
Environment
Fauxton on Apache CouchDB v. 2.3.1
PouchDB v. 7.2.1
Google Chrome version 87.0.4280.141
Windows 10 64bit
This issue was fixed in #1303. Fauxton was not generating the correct URL when the doc ID contains special characters such as %
, just like in your example. If you type in the correct URL the Conflicts page opens fine as you described.
The URL is http://127.0.0.1:5984/_utils/#database/recorder_recorder/color_Yellow_2021-01-21T12%253A02%253A51.089Z which is different from doc _id
This is expected because color_Yellow_2021-01-21T12%253A02%253A51.089Z
is the URL-encoded equivalent to your doc ID color_Yellow_2021-01-21T12%3A02%3A51.089Z
Nice. So the fix is available in latest CouchDB v3?
No. The fix was merged a month ago so it should be on the next CouchDB release, though I can't say when that will be.