diff options
Diffstat (limited to 'src/couchdb/couch_doc.erl')
-rw-r--r-- | src/couchdb/couch_doc.erl | 9 |
1 files changed, 6 insertions, 3 deletions
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]) -> |