Skip to content
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

Index view crashes when any database table is not accessible to actor #1305

Closed
gfrmin opened this issue Apr 22, 2021 · 0 comments
Closed

Index view crashes when any database table is not accessible to actor #1305

gfrmin opened this issue Apr 22, 2021 · 0 comments
Labels

Comments

@gfrmin
Copy link
Contributor

gfrmin commented Apr 22, 2021

Because of https://github.com/simonw/datasette/blob/main/datasette/views/index.py#L63, the tables dict built does not include invisible tables; however, if https://github.com/simonw/datasette/blob/main/datasette/views/index.py#L80 is reached (because table_counts was not successfully initialized, e.g. due to a very large database) then as db.get_all_foreign_keys() returns ALL tables, a KeyError will be raised.

This error can be recreated with the fixtures.db if any table is hidden, e.g. by adding something like "foreign_key_references": { "allow": {} } to fixtures-metadata.json and deleting or not table_counts from https://github.com/simonw/datasette/blob/main/datasette/views/index.py#L77.

I'm not sure how to fix this error; perhaps by testing if the table is in the aforementions tables dict.

gfrmin added a commit to gfrmin/datasette that referenced this issue Apr 22, 2021
gfrmin added a commit to gfrmin/datasette that referenced this issue Apr 22, 2021
gfrmin added a commit to gfrmin/datasette that referenced this issue Apr 22, 2021
@simonw simonw added the bug label Jun 2, 2021
@simonw simonw closed this as completed in 80d8b0e Jun 2, 2021
simonw added a commit that referenced this issue Jun 2, 2021
simonw added a commit that referenced this issue Jun 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants