couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Anderson" <>
Subject Re: slash escaping (was 0.9.0 Release)
Date Thu, 11 Dec 2008 21:44:36 GMT
On Thu, Dec 11, 2008 at 1:04 PM, Noah Slater <> wrote:
> People like using slashes in URLs, we can't change that.

Not only that, but developers often need control over the slashes of a
url (in order to make relative urls work nicely, etc). As it stands,
because some browsers treat urls like

as though it were

no matter what you do, there's no reliable way to link to say
../../docid from an attachment, without a dynamic attachment
(Javascript + browser) or hardcoding the database name in the
attachment. In the long run, pragmatism wins over perfection every

Also, I've already experienced fail when trying to host static-HTML
websites in CouchDB. Because designers tend to stick things in
directories, I have to go through and change all the HTML to work with
a flat namespace. (Or not use CouchDB.)

I still stand my (modulo Damien's caveat) proposed slash-escaping rule
set. It differs from the empty rule set (aka urlencode everything) but
I think it does not lead to ambiguities. I'll restate it here with
more clarity:

Rules for Docs with IDs that start with '_' (currently only _design/
and _local/, as per spec)


There is an additional constraint on design docs (which is a bug if
it's not already enforced programmatically) that the name must be
filesystem safe. We already have code devoted to validating database
names, applying it here is a no-brainer. For _local docs or new system
types which don't have to go to the filesystem, URL-escaping the name
section is appropriate.

Rules for attachments on regular docs are the same as above:


Docids will be URL-encoded, as they are now. The only change is that
attachment paths will have real slashes.

Chris Anderson

View raw message