summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_doc.erl
diff options
context:
space:
mode:
authorPaul Joseph Davis <davisp@apache.org>2011-01-28 01:52:47 +0000
committerPaul Joseph Davis <davisp@apache.org>2011-01-28 01:52:47 +0000
commita666c0a3ea2fe0b65e8fb9b5034c8d9a64f5a905 (patch)
tree06183ce02a95d85d6a6beb511157f4c632251ce1 /src/couchdb/couch_doc.erl
parent2e7ed944f2d23c2436f056e9649473cc891bd6e6 (diff)
Validate doc ids that come from a PUT to a URL.
Backprot of 1064417 from trunk. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1064421 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_doc.erl')
-rw-r--r--src/couchdb/couch_doc.erl4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/couchdb/couch_doc.erl b/src/couchdb/couch_doc.erl
index 7c64b8a9..e3d66145 100644
--- a/src/couchdb/couch_doc.erl
+++ b/src/couchdb/couch_doc.erl
@@ -165,6 +165,10 @@ parse_revs([Rev | Rest]) ->
validate_docid(Id) when is_binary(Id) ->
+ case couch_util:validate_utf8(Id) of
+ false -> throw({bad_request, <<"Document id must be valid UTF-8">>});
+ true -> ok
+ end,
case Id of
<<"_design/", _/binary>> -> ok;
<<"_local/", _/binary>> -> ok;