Reject documents whose ids start with underscore
------------------------------------------------

                 Key: COUCHDB-332
                 URL: https://issues.apache.org/jira/browse/COUCHDB-332
             Project: CouchDB
          Issue Type: Improvement
          Components: HTTP Interface
         Environment: 0.10.0a767851
            Reporter: Brian Candler
            Priority: Minor


docids which start with underscore are reserved for CouchDB. I believe they 
should be rejected to avoid confusion.

Currently observed behaviour:

(1) an attempt to PUT to /db/_docid succeeds, and creates a document whose ID 
starts with an underscore

$ curl -X PUT -d "{}" http://127.0.0.1:5984/foo/_xxx
{"ok":true,"id":"_xxx","rev":"1-1751372641"}


(2) a POST to /db/_docid tries to do something and fails; possibly it could 
succeed given the right headers and body.

$ curl -X POST -d "{}" http://127.0.0.1:5984/foo/_yyy
{"error":"bad_content_type","reason":"Invalid Content-Type header for form 
upload"}
-- status line show 415 Unsupported Media Type


This means that typos can result in confusing error messages; for example, a 
POST to /db/_tmp_view instead of /db/_temp_view. IMO it would be cleaner first 
to test the docid and reject it on that basis.

(Sorry, I am not including a test suite submission. It will be much easier for 
someone who already knows their way around the rather large set of private 
libraries which the test suite contains. I currently use Ruby to talk to 
CouchDB, not ECMAscript)


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to