summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/couchdb/couch_httpd_db.erl8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl
index 0ba8a873..005e32d1 100644
--- a/src/couchdb/couch_httpd_db.erl
+++ b/src/couchdb/couch_httpd_db.erl
@@ -720,13 +720,11 @@ validate_attachment_names(Doc) ->
validate_attachment_name(Name) when is_list(Name) ->
validate_attachment_name(list_to_binary(Name));
+validate_attachment_name(<<"_",_/binary>>) ->
+ throw({bad_request, <<"Attachment name can't start with '_'">>});
validate_attachment_name(Name) ->
case is_valid_utf8(Name) of
- true ->
- case Name of
- <<"_",_/binary>>=Name -> throw({bad_request, <<"Attachment name can't start with '_'">>});
- _ -> Name
- end;
+ true -> Name;
false -> throw({bad_request, <<"Attachment name is not UTF-8 encoded">>})
end.