diff options
author | iilyak <iilyak@users.noreply.github.com> | 2020-07-23 08:09:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-23 08:09:06 -0700 |
commit | 6875e7bf710cd2ffdf6d115af2bcd877012626c3 (patch) | |
tree | 6c7fb768296a760ed0c83cde2b9cd7c81c01408a | |
parent | 869a8f771fbc852feab7ca96119d1007bfc836df (diff) | |
parent | 822f2782ca3137fcbd710e3b87e95778fda5674b (diff) | |
download | couchdb-6875e7bf710cd2ffdf6d115af2bcd877012626c3.tar.gz |
Merge pull request #3027 from cloudant/fix-previous-bookmark
Fix 'first page should not return previous bookmark' test
-rw-r--r-- | src/couch_views/src/couch_views_http.erl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/couch_views/src/couch_views_http.erl b/src/couch_views/src/couch_views_http.erl index 8e12b2476..2aa9e9e85 100644 --- a/src/couch_views/src/couch_views_http.erl +++ b/src/couch_views/src/couch_views_http.erl @@ -177,10 +177,14 @@ maybe_add_next_bookmark(OriginalLimit, PageSize, Args0, Response, Items, KeyFun) maybe_add_previous_bookmark(#mrargs{extra = Extra} = Args, #{rows := Rows} = Result, KeyFun) -> StartKey = couch_util:get_value(fk, Extra), - case first_key(KeyFun, Rows) of - undefined -> + case {StartKey, first_key(KeyFun, Rows)} of + {undefined, _} -> Result; - EndKey -> + {_, undefined} -> + Result; + {StartKey, StartKey} -> + Result; + {StartKey, EndKey} -> Bookmark = bookmark_encode( Args#mrargs{ start_key = StartKey, |