couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jch...@apache.org
Subject svn commit: r750699 - /couchdb/trunk/src/couchdb/couch_httpd_db.erl
Date Fri, 06 Mar 2009 00:20:54 GMT
Author: jchris
Date: Fri Mar  6 00:20:53 2009
New Revision: 750699

URL: http://svn.apache.org/viewvc?rev=750699&view=rev
Log:
tiny refactor of validate_attachment_name for pattern matching

Modified:
    couchdb/trunk/src/couchdb/couch_httpd_db.erl

Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?rev=750699&r1=750698&r2=750699&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_db.erl Fri Mar  6 00:20:53 2009
@@ -720,13 +720,11 @@
 
 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.
 



Mime
View raw message