incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anh <7za...@gmail.com>
Subject Re: URL transformation within CouchDB?
Date Thu, 08 Apr 2010 19:14:47 GMT
No they cannot.
I'm implementing this as a content/file server which allows for nested
directories.

To support one document per file (important for file revisioning and
other file metadata), document ids like:

"/images/home/blah.png"
"/images/home/other.png"

must be URL encoded when requested from CouchDB directly:
http://couchdb:5984/db/images%2Fhome%2Fblah.png

Since I do not have an app server or Apache in "front off" Couch, I'd
like to know if there's a way to somehow make a direct request CouchDB
that includes one of more "/" characters in a document id.  (Rewrite,
redirect, show function, etc.)


(P.S. I'm aware that a document's attachments can have "/" in the ids
*but* this means I can only have a single doc for an entire directory
of files, which complicates my revisioning, metadata, etc)

Thanks


On Wed, Apr 7, 2010 at 9:40 PM, Andrew Melo <andrew.melo@gmail.com> wrote:
> Is there a specific reason you want to replace the slashes then? the
> users should still be able to access them, right?
>
> On Wed, Apr 7, 2010 at 11:38 PM, 7zark7 <7zark7@gmail.com> wrote:
>> On 4/7/10 9:15 PM, Randall Leeds wrote:
>>>
>>> On Wed, Apr 7, 2010 at 20:53, 7zark7<7zark7@gmail.com>  wrote:
>>>>
>>>> Hi, is there *any* way within CouchDB to modify a GET URL to replace
>>>> certain
>>>> characters in the document id?
>>>
>>> Probably easiest if you can have the client encode the URL for you. I
>>> don't know if that's acceptable for your use case.
>>
>> Yeah not in my case.  This is basically a CMS for static content, and the
>> end users aren't under my immediate control.
>>
>>
>>>> More specifically what I'd like to do is take a request URL that
>>>> contains forward slashes, such as:
>>>>
>>>> a/b/c/d.jpg
>>>>
>>>> and transform this to return a document which has the id:
>>>>
>>>> a%2Fb%2Fc%2Fd.jpg
>>>>
>>>> etc.
>>>>
>>>> I've tried the rewrite functionality, but doesn't look like it
>>>> supports modifying characters.  I've also tried hacky approaches
>>>> like this:
>>>>
>>>> {
>>>>   "from": "/file/:a/:b/:c/:d",
>>>>   "to": "../../:a%2:b%2:c%2:d"
>>>> }
>>>>
>>>> but the URL doesn't replace this correctly (shows "undefined" in the
>>>>  URL)
>>>>
>>>> show functions can't seem to handle rendering attachments as far as
>>>> I can tell.
>>>>
>>>> Any ideas?  I know about reverse proxys, etc, just would like to
>>>> avoid additional layers here.
>>>>
>>>>
>>>> Thanks
>>
>
>
>
> --
> --
> Andrew Melo
>

Mime
View raw message