You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Adam Kocoloski <ad...@gmail.com> on 2008/11/08 20:22:07 UTC

the "_design/blah" URL encoding issue

Hi, CouchDB used to have some special-case code (added in r663055)  
that would allow the '/' in a design document URL to be supplied  
without encoding.  The associated JIRA issue is

https://issues.apache.org/jira/browse/COUCHDB-49

Recent trunk builds still have that special case code, but it only  
takes effect if the HTTP verb is POST (see line 233 of  
couch_httpd_db.erl).  This actually breaks remote replication, since  
the _all_docs_by_seq view still reports design doc IDs as "_design/ 
blah", and couch_rep:open_doc_revs falls over when it tries to GET a  
document with that ID.

I'm happy to submit a patch to restore the old behavior.  Was there a  
reason for restricting the unencoded '/' code to POSTs?

By the way, using a '/' in the design doc ID suggests to me that  
_design/ is itself a valid resource.  Perhaps it would also make sense  
to add:

GET /dbname/_design/  -> retrieve a list of design documents
POST /dbname/_design/ -> create a new design doc with an auto- 
generated ID

GET /dbname/_view/blah/ -> retrieve a list of views defined in this  
design doc

What do others think?  Regards, Adam

Re: the "_design/blah" URL encoding issue

Posted by Ask Bjørn Hansen <as...@apache.org>.
Either the design documents are regular documents, or they aren't.  As  
it is requiring the / to be escaped sorta makes sense in that it makes  
them work the same as regular documents.

That being said - I like your idea of adding _design/ as a new  
resource -- and in that case it makes sense not to require the / to be  
escaped.  :-)


  - ask