diff options
author | ILYA Khlopotov <iilyak@apache.org> | 2020-07-23 07:13:54 -0700 |
---|---|---|
committer | Paul J. Davis <paul.joseph.davis@gmail.com> | 2020-09-09 09:44:58 -0500 |
commit | bc34ba357cbec5fc432a26879beab50adb7273f8 (patch) | |
tree | bdf06545c077f31a5ef2625b92491e229bc20358 | |
parent | 11491e4e9b69dfd6a51bb78e6753667caa41b864 (diff) | |
download | couchdb-bc34ba357cbec5fc432a26879beab50adb7273f8.tar.gz |
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, |