Report name of rejected attachment

Some users make requests from inside a black box with a blindfold on
and their eyes closed and are thus sometimes unaware of the names of
their own attachments. Let's help these people.

BugzID: 17669


Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/99284da1
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/99284da1
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/99284da1

Branch: refs/heads/import
Commit: 99284da1cd0a3559af8d2266665e2fe97e08943d
Parents: 30c8bc5
Author: Robert Newson <robert.new...@cloudant.com>
Authored: Thu Feb 28 10:17:11 2013 +0000
Committer: Robert Newson <robert.new...@cloudant.com>
Committed: Wed Mar 6 12:22:38 2013 -0600

----------------------------------------------------------------------
 src/chttpd_db.erl | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/99284da1/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index d155232..ef4303b 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -1257,8 +1257,9 @@ 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(<<"_",Rest/binary>>) ->
+    throw({bad_request, <<"Attachment name '_", Rest/binary,
+                          "' starts with prohibited character '_'">>});
 validate_attachment_name(Name) ->
     case couch_util:validate_utf8(Name) of
         true -> Name;

Reply via email to