Use dash encoding for table names, refs #1439

This commit is contained in:
Simon Willison 2022-03-06 15:38:44 -08:00
commit b760264ae6
5 changed files with 18 additions and 18 deletions

View file

@ -140,7 +140,7 @@ def test_database_page(app_client):
assert queries_ul is not None
assert [
(
"/fixtures/%F0%9D%90%9C%F0%9D%90%A2%F0%9D%90%AD%F0%9D%90%A2%F0%9D%90%9E%F0%9D%90%AC",
"/fixtures/-F0-9D-90-9C-F0-9D-90-A2-F0-9D-90-AD-F0-9D-90-A2-F0-9D-90-9E-F0-9D-90-AC",
"𝐜𝐢𝐭𝐢𝐞𝐬",
),
("/fixtures/from_async_hook", "from_async_hook"),
@ -193,11 +193,11 @@ def test_row_redirects_with_url_hash(app_client_with_hash):
def test_row_strange_table_name_with_url_hash(app_client_with_hash):
response = app_client_with_hash.get("/fixtures/table%2Fwith%2Fslashes.csv/3")
response = app_client_with_hash.get("/fixtures/table-2Fwith-2Fslashes-2Ecsv/3")
assert response.status == 302
assert response.headers["Location"].endswith("/table%2Fwith%2Fslashes.csv/3")
assert response.headers["Location"].endswith("/table-2Fwith-2Fslashes-2Ecsv/3")
response = app_client_with_hash.get(
"/fixtures/table%2Fwith%2Fslashes.csv/3", follow_redirects=True
"/fixtures/table-2Fwith-2Fslashes-2Ecsv/3", follow_redirects=True
)
assert response.status == 200

View file

@ -121,7 +121,7 @@ def test_database(ds, base_url, format, expected):
("/", "name", None, "/_memory/name"),
("/prefix/", "name", None, "/prefix/_memory/name"),
("/", "name", "json", "/_memory/name.json"),
("/", "name.json", "json", "/_memory/name.json?_format=json"),
("/", "name.json", "json", "/_memory/name-2Ejson.json"),
],
)
def test_table_and_query(ds, base_url, name, format, expected):