From 223646af60465522572cfea014f35bfa68496d0e Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Wed, 9 Nov 2011 13:08:49 +0000 Subject: Conditionally apply JSON encoding to update_seq values BigCouch 0.3 cannot parse requests of the form /db/_changes?since="123-foo" so the recent ?JSON_ENCODE addition to Since in two places causes 0.3 <-> 0.4 replication to fail with json_encode/badterm errors. This patch applies JSON encoding only when the Since value is not already a binary (i.e, when it's a [integer(), binary()]) and interop is restored. BugzID: 12833 --- apps/couch/src/couch_rep_changes_feed.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'apps/couch/src/couch_rep_changes_feed.erl') diff --git a/apps/couch/src/couch_rep_changes_feed.erl b/apps/couch/src/couch_rep_changes_feed.erl index 70db52a0..651069fb 100644 --- a/apps/couch/src/couch_rep_changes_feed.erl +++ b/apps/couch/src/couch_rep_changes_feed.erl @@ -64,7 +64,8 @@ init([Parent, #http_db{headers = Headers0} = Source, Since, PostProps]) -> BaseQS = [ {"style", all_docs}, {"heartbeat", 10000}, - {"since", iolist_to_binary(?JSON_ENCODE(Since))}, + {"since", case Since of Bin when is_binary(Bin) -> Bin; + Else -> iolist_to_binary(?JSON_ENCODE(Else)) end}, {"feed", Feed} ], {QS, Method, Body, Headers} = case get_value(<<"doc_ids">>, PostProps) of -- cgit v1.2.3