couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Anderson" <>
Subject slash escaping (was 0.9.0 Release)
Date Thu, 11 Dec 2008 19:39:10 GMT
On Wed, Dec 3, 2008 at 3:59 PM, Antony Blakey <> wrote:
> On 04/12/2008, at 9:55 AM, Chris Anderson wrote:
>> On Wed, Dec 3, 2008 at 6:09 AM, Adam Kocoloski <>
>> wrote:
>>> 2) The "/" in the _design doc ID is confusing.
>> Oh someone, please make it easy! (and correct)
> Someone please make it absolutely, 100%, correct.

The more I program against Couch, especially in a browser, the more I
run into issues where different parts of the toolchain tend toward
auto-unescaping %2F. It's hard to be certain that I've got something
absolutely, 100% correct, but we'll never get there if we don't start.

Here are some examples which assume that docid's slashes will be
urlencoded (unless the docid starts with '_'). This is the current
rule (roughly). Each example has 2 urls with attachments that have no
slashes in the name, followed by a url with an attachment with
multiple slashes. I think it is feasible to allow this sort of thing
to happen, by putting a little bit of special-case logic in the
routing code. I don't think doing so breaks anything fundamental about

regular docs:


design docs:


If your docid does not start with '_' (eg not a local or design doc)
then any slashes in the docid would have to be escaped. This is so we
can know when attachment addressing begins. Also, design docs with
slashes after the inital one (slashes in the name) would have to
escape them.

regular doc with slashes in id:


design doc with slashes in name:


> Special names, special paths, sometimes encoding, sometimes not. Such magic
> is evil because it always comes back to bite your arse.

I think I may have this correct - eg non arse biting. But I'm posting
to the dev list because y'all might see what I don't.

I plan to put this into trunk before 1.0 (I think it will be backwards
compatible). Comments?


Chris Anderson

View raw message