Even more confusing:
GET /images/a0cbe43b55828d33320cf6cbd40bdb81?attachments=true
does include the data part base84 encoded

and return {
        base64: --data;
}
works as well.

why is the combination of those not possible?

Jan

Am 28.05.2010 13:10, schrieb Robert Newson:
Attachments aren't available through show functions. JSON and binary
don't place nicely together. What makes it a little more confusing is
that you'll see the _attachments object in your document with
everything *except* the data. :)

B.

On Fri, May 28, 2010 at 11:58 AM, Jan Prieser<[email protected]>  wrote:
Hi,

is it possible to deliver an attachment through a show function?
i've tried this with no success:
GET
/images/_design/images/_show/onlineimage/a0cbe43b55828d33320cf6cbd40bdb81?attachments=true

function (doc, req) {
        if (doc.type == "image"&&  doc.online == "online") {
                return {
                        body: doc._attachments["filename"].data,
                        headers: { "content-type" :
doc._attachments["filename"].content_type}

                }
        }
        else {
                return 'not found or offline';
        }
}

Reason is to rewrite this URL in varnish cache and only deliver images which
are flagged online in doc.online.
My application would ask for http://varnish/image/<imagedocid>  and only get
online images.
I'm trying to avoid an extra http roundtrip through the application server.

any ideas how to accomplish this scenario?

regards,
jan prieser

Reply via email to