Escape state_dir in the db_url derived from it (closes #290)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
When db_url is omitted, pixa derives it from state_dir, and it put the directory name into a file: URL as it was, so a state_dir holding %, ? or # opened another file and lost the journal mode. The derived URL is now built with net/url, which percent-encodes the directory name; an ordinary path gives the same URL as before. When the path written into the URL starts with //, as for a state_dir of / or one starting with //, the empty host is kept so SQLite does not read the first name in the path as a host. Model: opus-5-5
This commit was merged in pull request #292.
This commit is contained in:
@@ -725,11 +725,14 @@ Key settings in more detail:
|
||||
- `signing_key` — HMAC secret for URL signatures
|
||||
- `db_url` — the SQLite database to open; omitted, it is
|
||||
`file:<state_dir>/state.sqlite3?_pragma=journal_mode(WAL)`, which keeps the
|
||||
database in WAL mode. pixa opens one connection to it, so its own reads and
|
||||
writes run one at a time. pixa adds `_pragma=busy_timeout(5000)` to any
|
||||
`db_url`, so a write that finds another program writing to the file waits up
|
||||
to five seconds for it instead of failing. WAL mode comes only from the URL:
|
||||
keep `_pragma=journal_mode(WAL)` in one you set
|
||||
database in WAL mode. `state_dir` is percent-encoded in it, so a `%`, `?` or
|
||||
`#` in the name is written as `%25`, `%3F` or `%23`. For a `state_dir` of `/`
|
||||
or one starting with `//` it starts `file:////`, so SQLite does not read the
|
||||
first name in the path as a host. pixa opens one connection to it, so its own
|
||||
reads and writes run one at a time. pixa adds `_pragma=busy_timeout(5000)` to
|
||||
any `db_url`, so a write that finds another program writing to the file waits
|
||||
up to five seconds for it instead of failing. WAL mode comes only from the
|
||||
URL: keep `_pragma=journal_mode(WAL)` in one you set
|
||||
- `cache_max_bytes` — disk cache size limit in bytes; `0` disables the disk
|
||||
cache entirely; omitted defaults to 75% of the sum of the free space on the
|
||||
filesystem containing `<state_dir>/cache/` and the bytes of source and
|
||||
|
||||
Reference in New Issue
Block a user