couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Lehnardt <>
Subject Re: attachments with names with leading underscore
Date Wed, 02 Nov 2011 16:47:05 GMT

On Nov 2, 2011, at 17:28 , Jason Sachs wrote:

> So I gather from a python-couchdb error message that attachments must
> not have names with leading underscores.
> This is not mentioned in
> (though it makes sense given the special meaning of underscores
> elsewhere in couchdb)
> Could someone please update the wiki to reflect this information?

It's a wiki , fancy helping out? :)

> Also what other restrictions are there on attachment filenames?

The source for this (in master) is here:;a=blob;f=src/couchdb/couch_httpd_db.erl;h=3d2d2c1f301b6c733bd2cf5949c9e63b4e11baa3;hb=refs/heads/master#l1320

In detail this means:

    validate_attachment_name(Name) when is_list(Name) ->

Ignore, it's Erlang internals. We're just making sure we operate on a binary rather than a
list datatype.

    validate_attachment_name(<<"_",_/binary>>) ->
        throw({bad_request, <<"Attachment name can't start with '_'">>});

What you found, they can't start with an underscore.

    validate_attachment_name(Name) ->
        case couch_util:validate_utf8(Name) of
            true -> Name;
            false -> throw({bad_request, <<"Attachment name is not UTF-8 encoded">>})

Finally, the name's gotta be UTF-8 encoded.


View raw message