summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_httpd_db.erl
diff options
context:
space:
mode:
authorPaul Joseph Davis <davisp@apache.org>2009-04-27 19:41:23 +0000
committerPaul Joseph Davis <davisp@apache.org>2009-04-27 19:41:23 +0000
commitb97ea7c6b7c52430393ec7107674ba23ff57b9d5 (patch)
tree41591439b98ef9c2a91a8a4ef5e4c065b5001287 /src/couchdb/couch_httpd_db.erl
parentf5d752a3c5f1c05962a7b693b54636967bfa7a5d (diff)
Resolves COUCHDB-332 Proper errors for invalid docids.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@769127 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_httpd_db.erl')
-rw-r--r--src/couchdb/couch_httpd_db.erl2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl
index d8a2a971..4fa5a9b6 100644
--- a/src/couchdb/couch_httpd_db.erl
+++ b/src/couchdb/couch_httpd_db.erl
@@ -497,6 +497,7 @@ db_doc_req(#httpd{method='GET'}=Req, Db, DocId) ->
end;
db_doc_req(#httpd{method='POST'}=Req, Db, DocId) ->
+ couch_doc:validate_docid(DocId),
case couch_httpd:header_value(Req, "content-type") of
"multipart/form-data" ++ _Rest ->
ok;
@@ -525,6 +526,7 @@ db_doc_req(#httpd{method='POST'}=Req, Db, DocId) ->
]});
db_doc_req(#httpd{method='PUT'}=Req, Db, DocId) ->
+ couch_doc:validate_docid(DocId),
Location = absolute_uri(Req, "/" ++ ?b2l(Db#db.name) ++ "/" ++ ?b2l(DocId)),
update_doc(Req, Db, DocId, couch_httpd:json_body(Req),
[{"Location", Location}]);