kopia lustrzana https://github.com/simonw/datasette
Fix bug with ?_next=x&_sort=rowid, closes #1470
rodzic
1163da8916
commit
875117c343
|
@ -588,13 +588,15 @@ class TableView(RowTableShared):
|
||||||
_next = _next or special_args.get("_next")
|
_next = _next or special_args.get("_next")
|
||||||
offset = ""
|
offset = ""
|
||||||
if _next:
|
if _next:
|
||||||
|
sort_value = None
|
||||||
if is_view:
|
if is_view:
|
||||||
# _next is an offset
|
# _next is an offset
|
||||||
offset = f" offset {int(_next)}"
|
offset = f" offset {int(_next)}"
|
||||||
else:
|
else:
|
||||||
components = urlsafe_components(_next)
|
components = urlsafe_components(_next)
|
||||||
# If a sort order is applied, the first of these is the sort value
|
# If a sort order is applied and there are multiple components,
|
||||||
if sort or sort_desc:
|
# the first of these is the sort value
|
||||||
|
if (sort or sort_desc) and (len(components) > 1):
|
||||||
sort_value = components[0]
|
sort_value = components[0]
|
||||||
# Special case for if non-urlencoded first token was $null
|
# Special case for if non-urlencoded first token was $null
|
||||||
if _next.split(",")[0] == "$null":
|
if _next.split(",")[0] == "$null":
|
||||||
|
|
|
@ -1817,3 +1817,9 @@ def test_facet_total_shown_if_facet_max_size(use_facet_size_max):
|
||||||
assert fragment in response.text
|
assert fragment in response.text
|
||||||
else:
|
else:
|
||||||
assert fragment not in response.text
|
assert fragment not in response.text
|
||||||
|
|
||||||
|
|
||||||
|
def test_sort_rowid_with_next(app_client):
|
||||||
|
# https://github.com/simonw/datasette/issues/1470
|
||||||
|
response = app_client.get("/fixtures/binary_data?_size=1&_next=1&_sort=rowid")
|
||||||
|
assert response.status == 200
|
||||||
|
|
Ładowanie…
Reference in New Issue