From f33c9001915086b9c1b5d61c8e5addf08a4cf724 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Tue, 15 Mar 2022 08:31:10 -0700 Subject: [PATCH] Got a couple more test to pass --- datasette/views/base.py | 2 +- tests/test_api.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/datasette/views/base.py b/datasette/views/base.py index c11e6aef..0d34ba71 100644 --- a/datasette/views/base.py +++ b/datasette/views/base.py @@ -453,7 +453,7 @@ class DataView(BaseView): # _format may be in captured by the URL router as_format = kwargs.pop("as_format", None) if as_format: - _format = as_format + _format = as_format.lstrip(".") else: # If there's a '.' in the last portion of the path, use that as format: last_path_component = request.path.split("/")[-1] diff --git a/tests/test_api.py b/tests/test_api.py index ba7ec3c5..87363a84 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -681,7 +681,7 @@ def test_row(app_client): def test_row_strange_table_name(app_client): response = app_client.get( - "/fixtures/table-2Fwith-2Fslashes-2Ecsv/3.json?_shape=objects" + "/fixtures/table~2Fwith~2Fslashes~2Ecsv/3.json?_shape=objects" ) assert response.status == 200 assert [{"pk": "3", "content": "hey"}] == response.json["rows"]