openDB (db.go) builds the SQLite connection string as "file:" + path + "?_pragma=..." with the path unescaped. The driver
treats the first ? as the start of the options and # as a
fragment, so a database path containing ?, # or % — legal in a
Unix path, and the path comes straight from SFDUPES_DATABASE — opens
a different file than the one named, silently. scan then creates and
fills a database at the truncated path while reporting success against
the requested one.
Definition of done
The path is escaped when the connection string is built (a net/urlURL{Scheme: "file", Path: ...} or equivalent standard
library call; nothing hand-rolled), so every byte of the path
reaches SQLite as part of the file name.
A test runs scan then report with SFDUPES_DATABASE pointing
at a file whose name contains ?, #, % and a space, and
asserts that exactly that file exists afterwards and no truncated
sibling does.
Relative database paths keep working.
make check green.
Touches db.go; sequence after #8, which rewrites the same
function.
Model: fable-5-1
`openDB` (`db.go`) builds the SQLite connection string as
`"file:" + path + "?_pragma=..."` with the path unescaped. The driver
treats the first `?` as the start of the options and `#` as a
fragment, so a database path containing `?`, `#` or `%` — legal in a
Unix path, and the path comes straight from `SFDUPES_DATABASE` — opens
a different file than the one named, silently. `scan` then creates and
fills a database at the truncated path while reporting success against
the requested one.
## Definition of done
1. The path is escaped when the connection string is built (a
`net/url` `URL{Scheme: "file", Path: ...}` or equivalent standard
library call; nothing hand-rolled), so every byte of the path
reaches SQLite as part of the file name.
2. A test runs `scan` then `report` with `SFDUPES_DATABASE` pointing
at a file whose name contains `?`, `#`, `%` and a space, and
asserts that exactly that file exists afterwards and no truncated
sibling does.
3. Relative database paths keep working.
4. `make check` green.
Touches `db.go`; sequence after
https://git.eeqj.de/sneak/sfdupes/issues/8, which rewrites the same
function.
Model: fable-5-1
clawbot
added this to the 1.0.0 milestone 2026-09-21 09:17:54 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
openDB(db.go) builds the SQLite connection string as"file:" + path + "?_pragma=..."with the path unescaped. The drivertreats the first
?as the start of the options and#as afragment, so a database path containing
?,#or%— legal in aUnix path, and the path comes straight from
SFDUPES_DATABASE— opensa different file than the one named, silently.
scanthen creates andfills a database at the truncated path while reporting success against
the requested one.
Definition of done
net/urlURL{Scheme: "file", Path: ...}or equivalent standardlibrary call; nothing hand-rolled), so every byte of the path
reaches SQLite as part of the file name.
scanthenreportwithSFDUPES_DATABASEpointingat a file whose name contains
?,#,%and a space, andasserts that exactly that file exists afterwards and no truncated
sibling does.
make checkgreen.Touches
db.go; sequence after#8, which rewrites the same
function.
Model: fable-5-1