mirror of
https://github.com/simonw/datasette.git
synced 2026-06-09 02:26:59 +02:00
Fix double-prefixed export links with base_url
Use the router-stripped route_path when building request-derived export URLs, so table, row, and query JSON/CSV links do not apply base_url twice. Keep urls.path() behavior unchanged, and add coverage for both /prefix/ exports and a /data/ base_url with a data database. Closes #2759
This commit is contained in:
parent
81a4df8a3e
commit
d657fb4315
7 changed files with 118 additions and 11 deletions
|
|
@ -453,6 +453,12 @@ def test_path_with_format(path, format, extra_qs, expected):
|
|||
assert expected == actual
|
||||
|
||||
|
||||
def test_path_with_format_can_override_request_path():
|
||||
request = Request.fake("/prefix/foo?x=1")
|
||||
actual = utils.path_with_format(request=request, path="/foo", format="json")
|
||||
assert "/foo.json?x=1" == actual
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"bytes,expected",
|
||||
[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue