-
-
Notifications
You must be signed in to change notification settings - Fork 700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Certain database names results in 404: "Database not found: None" #1181
Comments
Yes, that logic is definitely at fault. It looks like it applies datasette/datasette/views/base.py Lines 184 to 198 in 97fb10c
|
I'm going to add a unit test that tries a variety of weird database names. |
Here's the incomplete sketch of a test - to go at the bottom of @pytest.mark.parametrize(
"filename", ["test-database (1).sqlite", "database (1).sqlite"]
)
def test_weird_database_names(ensure_eventloop, tmpdir, filename):
# https://github.com/simonw/datasette/issues/1181
runner = CliRunner()
db_path = str(tmpdir / filename)
sqlite3.connect(db_path).execute("vacuum")
result1 = runner.invoke(cli, [db_path, "--get", "/"])
assert result1.exit_code == 0, result1.output
homepage_html = result1.output
assert False |
I wonder if I'm encountering the same bug (or something related). I had previously been using the .csv feature to run queries and then fetch results for the pandas |
I have a file named
test-database (1).sqlite
. When requesting the home route/
, I see datasette is able to read it correctly:However, if I click any of the links, datasette replies with:
Error 404 Database not found: None
It seems the hash is crucial, as renaming the file to
database (1).sqlite
makes the error go away.This lines checks for a single dash:
datasette/datasette/views/base.py
Line 184 in 97fb10c
Version:
The text was updated successfully, but these errors were encountered: