Fix for row pages for tables with / in, closes #325

This commit is contained in:
Simon Willison 2018-07-07 22:21:51 -07:00
commit 6541ce633e
No known key found for this signature in database
GPG key ID: 17E2DEA2588B7F52
4 changed files with 34 additions and 2 deletions

View file

@ -865,6 +865,12 @@ def test_row(app_client):
assert [{'id': '1', 'content': 'hello'}] == response.json['rows']
def test_row_strange_table_name(app_client):
response = app_client.get('/fixtures/table%2Fwith%2Fslashes.csv/3.json?_shape=objects')
assert response.status == 200
assert [{'pk': '3', 'content': 'hey'}] == response.json['rows']
def test_row_foreign_key_tables(app_client):
response = app_client.get('/fixtures/simple_primary_key/1.json?_extras=foreign_key_tables')
assert response.status == 200

View file

@ -56,6 +56,19 @@ def test_row(app_client):
assert response.status == 200
def test_row_strange_table_name(app_client):
response = app_client.get(
'/fixtures/table%2Fwith%2Fslashes.csv/3',
allow_redirects=False
)
assert response.status == 302
assert response.headers['Location'].endswith(
'/table%2Fwith%2Fslashes.csv/3'
)
response = app_client.get('/fixtures/table%2Fwith%2Fslashes.csv/3')
assert response.status == 200
def test_add_filter_redirects(app_client):
filter_args = urllib.parse.urlencode({
'_filter_column': 'content',