From db6c33efaab3f16495e439fc01ccd5f55a0ece43 Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Sun, 15 Mar 2009 00:15:40 +0000 Subject: error message on invalid rev format. another replication test. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@754563 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_doc.erl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/couchdb/couch_doc.erl b/src/couchdb/couch_doc.erl index fc817d56..3c4fd98c 100644 --- a/src/couchdb/couch_doc.erl +++ b/src/couchdb/couch_doc.erl @@ -129,9 +129,12 @@ from_json_obj(_Other) -> parse_rev(Rev) when is_binary(Rev) -> parse_rev(?b2l(Rev)); parse_rev(Rev) -> - {Pos, [$- | RevId]} = lists:splitwith(fun($-) -> false; (_) -> true end, Rev), - {list_to_integer(Pos), ?l2b(RevId)}. - + SplitRev = lists:splitwith(fun($-) -> false; (_) -> true end, Rev), + case SplitRev of + {Pos, [$- | RevId]} -> {list_to_integer(Pos), ?l2b(RevId)}; + _Else -> throw({bad_request, <<"Invalid rev format">>}) + end. + parse_revs([]) -> []; parse_revs([Rev | Rest]) -> -- cgit v1.2.3