Hi all,

I noticed the following discrepancy: When you try to request a design document, and you encode the / as %2F, couchdb will redirect you to a URL with %2f decoded to /, which works.

However, for any other documents, you must encode the / as %2f. For _view URLs, you must put /. For JSON key values, you can use both.

Examples:
[info] [<0.19011.2>] 127.0.0.1 - - 'GET' /vavoom/_design%2Fmacaddr 301
[info] [<0.19020.2>] 127.0.0.1 - - 'GET' /vavoom/_design/macaddr 304

[info] [<0.19029.2>] 127.0.0.1 - - 'GET' /vavoom/mac/00:50:56:00:02:02 404 [info] [<0.19029.2>] 127.0.0.1 - - 'GET' /vavoom/mac %2f00:50:56:00:02:02 200

[info] [<0.21779.2>] 127.0.0.1 - - 'GET' /vavoom/_view%2fimages%2fall? include_docs=true 404 [info] [<0.21807.2>] 127.0.0.1 - - 'GET' /vavoom/_view%2fimages/all? include_docs=true 404 [info] [<0.21807.2>] 127.0.0.1 - - 'GET' /vavoom/_view/images%2fall? include_docs=true 405 [info] [<0.21807.2>] 127.0.0.1 - - 'GET' /vavoom/_view/images/all? include_docs=true 200

[info] [<0.22633.2>] 127.0.0.1 - - 'GET' /vavoom/_all_docs?startkey= %22mac/00:50:56:00:02:02%22&limit=1 200 [info] [<0.22633.2>] 127.0.0.1 - - 'GET' /vavoom/_all_docs?startkey= %22mac%2f00:50:56:00:02:02%22&limit=1 200

Is there logic behind this? Would it be possible to allow unchanged / in keys that are accessed directly?

The reason I ask is that it would be very natural to put the type of a document as a prefix to the document. This gives you instant views like [info] [<0.20301.2>] 127.0.0.1 - - 'GET' /vavoom/_all_docs?startkey= %22mac/%22&endkey=%22mac?%22 304 and for a wiki you could have subsections under like _show/wiki/ showpage/section/subsection/page

Cheers,

Wout.

Reply via email to