Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-1368

multipart/related document body doesn't identify which part is which attachment

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.1, 1.4.0
    • Component/s: HTTP Interface
    • Labels:
      None

      Description

      If you GET a document with attachments in multipart/related format (by adding ?attachments=true and setting Accept:multipart/related), the MIME bodies for the attachments have no headers. This makes it difficult to tell which one is which. Damien says they're in the same order that they appear in the document's "_attachments" object ... which is fine if you're Erlang, because Erlang preserves the order of keys in a JSON object, but no other JSON implementation I know of does that (because they use hashtables instead of linked lists.)

      The upshot is that any non-Erlang code trying to parse such a response will have to do some by-hand parsing of the JSON data to get the _attachment keys in order.

      This can be fixed by adding a "Content-ID" header to each attachment body, whose value is the filename. It would be nice if other standard headers were added too, like "Content-Type", "Content-Length", "Content-Encoding", as this would make it work better with existing MIME multipart libraries.

        Attachments

        1. replication.log
          11 kB
          Christopher Bonhage

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                snej Jens Alfke
              • Votes:
                2 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: