couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <>
Subject Re: Changing an attachment content-type through Futons source editor.
Date Tue, 03 Nov 2009 05:02:12 GMT

> However I noticed sometimes someone uploads an attachment but Firefox
> got the content-type wrong (done on the client side with my SUPER
> HACK).  To correct this, I use Futon to edit the document JSON source
> and change the content_type and save the document. But my change to
> the content_type field does not get saved.

I'm actually not entirely sure what would happen in this scenario. I
don't think we test it anywhere. Since futon grabs the _attachments
data as a stub, saving it back to the DB with the non-inline style
should just ignore any changes you make. And now that you mention it,
I don't think there's actually a way to change the content-type
without re-uploading the binary data. That definitely seems like
overlooked functionality, but not quite a bug.

>       // Mime-type SUPER HACK
>       xhr.setRequestHeader("Content-Type",
> file.getAsDataURL().match(/data:([^;]*);/)[1]);
>       xhr.sendAsBinary(file.getAsBinary());

I have never ever seen JavaScript that does such things. Is this
actually possible in a cross browser fashion or some FF extension?

Paul Davis

View raw message