Skip to content

Ensure db.path is a string before trying to insert into internal database#1370

Merged
simonw merged 1 commit intosimonw:mainfrom
eyeseast:1365-path-to-str
Jun 21, 2021
Merged

Ensure db.path is a string before trying to insert into internal database#1370
simonw merged 1 commit intosimonw:mainfrom
eyeseast:1365-path-to-str

Conversation

@eyeseast
Copy link
Contributor

@eyeseast eyeseast commented Jun 8, 2021

Fixes #1365

This is the simplest possible fix, with a test that will fail without it. There are a bunch of places where db.path is getting converted to and from a Path type, so this fix errs on the side of calling str(db.path) right before it's inserted.

@simonw
Copy link
Owner

simonw commented Jun 8, 2021

We can remove a bunch of unnecessary str(path) calls too - this search finds a bunch of possible candidates: https://ripgrep.datasette.io/-/ripgrep?pattern=str%5C%28.*%28db%7Cpath%29&glob=datasette%2F**%2F*.py

@eyeseast
Copy link
Contributor Author

eyeseast commented Jun 9, 2021

I'm happy to grab some or all of these in this PR, if you want.

@simonw simonw merged commit a6c55af into simonw:main Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pathlib.Path breaks internal schema

2 participants