Robert Kowalski created COUCHDB-2748:
----------------------------------------
Summary: encoding problems with reserved chars
Key: COUCHDB-2748
URL: https://issues.apache.org/jira/browse/COUCHDB-2748
Project: CouchDB
Issue Type: Bug
Security Level: public (Regular issues)
Components: Database Core
Reporter: Robert Kowalski
Let's create a database!
curl -X PUT http://localhost:5984/testrainyday
I get:
{"ok":true}
Let's create a document called BANANA%25
curl -X PUT http://localhost:5984/testrainyday/BANANA%253A21%25 -d '{}'
CouchDB returns:
{"_id":"BANANA%3A21%","_rev":"1-967a00dff5e02add41819138abb3284d"}
(note the changed id - it misses the 25)
lets use the id from the response to retrieve the doc:
curl http://localhost:5984/testrainyday/BANANA%3A21%
i get:
{"error":"not_found","reason":"missing"}
:(
New try:
curl http://localhost:5984/testrainyday/_all_docs
returns:
{"total_rows":1,"offset":0,"rows":[
{"id":"BANANA%3A21%","key":"BANANA%3A21%","value":{"rev":"1-967a00dff5e02add41819138abb3284d"}}
]}
I get BANANA%3A21% as id again, but when I want to curl it or use in my JS
application, I get `{"error":"not_found","reason":"missing"}`
I noticed that it works for these two ids:
curl -X PUT http://localhost:5984/testrainyday/BANANA%25 -d '{}'
{"ok":true,"id":"BANANA%","rev":"1-967a00dff5e02add41819138abb3284d"}
In this last case it works magically for both ids:
{monospace}
(17:54:11) [robert@tequila-work] ~/apache/couchdb-fauxton (master *) $ curl -X
PUT http://localhost:5984/testrainyday/BANANA%25 -d '{}'
{"ok":true,"id":"BANANA%","rev":"1-967a00dff5e02add41819138abb3284d"}
(17:55:45) [robert@tequila-work] ~/apache/couchdb-fauxton (master *) $ curl
http://localhost:5984/testrainyday/BANANA%25
{"_id":"BANANA%","_rev":"1-967a00dff5e02add41819138abb3284d"}
(17:55:57) [robert@tequila-work] ~/apache/couchdb-fauxton (master *) $ curl
http://localhost:5984/testrainyday/BANANA%
{"_id":"BANANA%","_rev":"1-967a00dff5e02add41819138abb3284d"}
{monospace}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)