couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <>
Subject Issue with null MIME type for attachments
Date Sun, 25 Jan 2009 16:41:43 GMT
I am running couchdb SVN r736610 under Ubuntu Hardy (but with Erlang 12B3
packages from Intrepid)

After deploying sofa (git id 5222915fded972ddc55058c3fd97fa2bca366499) using
couchapp (gem 0.1.4), I notice that one of the attachments to _design/sofa
has a null content_type:

   "_attachments": {
       "to_couch.rb": {
           "stub": true,
           "content_type": null,
           "length": 1460

And if I try to retrieve this using HTTP, I get an error:

$ curl

Retrieving other attachments with non-null content types works fine.

Is it expected behaviour that a client app can upload an attachment in such
a way that it cannot be downloaded again? I think the server should either
fail the upload, or default the MIME type to application/octet-stream.

I see that couchapp is mapping MIME types via a Ruby hash:

    "content_type" => MIMES[path.split('.').last]

and since .rb is not known it is setting it to nil, which ends up as null in
the JSON.

The problem can be replicated easily without sofa/couchapp as follows:

$ curl -d '{"_attachments":{"foo.bin":{"content_type":null,"data":"aGVsbG8="}}}'
$ curl
$ curl



View raw message