kopia lustrzana https://github.com/simonw/datasette
Fixed broken CSS on 404 page, closes #777
rodzic
49d6d2f7b0
commit
647c5ff0f3
|
@ -1015,7 +1015,16 @@ class DatasetteRouter(AsgiRouter):
|
|||
templates = ["500.html"]
|
||||
if status != 500:
|
||||
templates = ["{}.html".format(status)] + templates
|
||||
info.update({"ok": False, "error": message, "status": status, "title": title})
|
||||
info.update(
|
||||
{
|
||||
"ok": False,
|
||||
"error": message,
|
||||
"status": status,
|
||||
"title": title,
|
||||
"base_url": self.ds.config("base_url"),
|
||||
"app_css_hash": self.ds.app_css_hash(),
|
||||
}
|
||||
)
|
||||
headers = {}
|
||||
if self.ds.cors:
|
||||
headers["Access-Control-Allow-Origin"] = "*"
|
||||
|
|
|
@ -965,6 +965,18 @@ def inner_html(soup):
|
|||
return inner_html.strip()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path", ["/404", "/fixtures/404"])
|
||||
def test_404(app_client, path):
|
||||
response = app_client.get(path)
|
||||
assert 404 == response.status
|
||||
assert (
|
||||
'<link rel="stylesheet" href="/-/static/app.css?{}'.format(
|
||||
app_client.ds.app_css_hash()
|
||||
)
|
||||
in response.text
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"path,expected_redirect",
|
||||
[("/fixtures/", "/fixtures"), ("/fixtures/simple_view/", "/fixtures/simple_view")],
|
||||
|
|
Ładowanie…
Reference in New Issue