Skip to content

fix: decode percent-encoded path in sqlite database URL - #1406

Open
AlisinaDevelo wants to merge 1 commit into
golang-migrate:masterfrom
AlisinaDevelo:fix-sqlite-encoded-path
Open

fix: decode percent-encoded path in sqlite database URL#1406
AlisinaDevelo wants to merge 1 commit into
golang-migrate:masterfrom
AlisinaDevelo:fix-sqlite-encoded-path

Conversation

@AlisinaDevelo

Copy link
Copy Markdown

Closes #1256.

The sqlite driver built its DSN from purl.String(), which re-encodes the URL path. A database URL like sqlite:///Magic%20Data/db.sqlite was passed to sql.Open with the %20 intact, so it looked for a literal Magic%20Data file and failed to connect.

Now the DSN is built from the decoded path (still keeping any non-custom query params, e.g. sqlite pragmas). Added a test that opens a DB under a directory with a space in the name.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 54.468% (+0.04%) from 54.432% — AlisinaDevelo:fix-sqlite-encoded-path into golang-migrate:master

@AlisinaDevelo

Copy link
Copy Markdown
Author

Checking in on the SQLite URL fix. It decodes percent-encoded path components while preserving query parameters, and Go 1.24 and 1.25 tests, lint, and coverage checks are green. If this still fits the project’s direction, could someone take a look when there’s a chance? I’m happy to rebase or adjust the path handling.

@AlisinaDevelo

Copy link
Copy Markdown
Author

Hey, checking in on the SQLite URL fix—does the path handling need anything else from me before review?

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.

sqlite cannot handle encoded URI's

2 participants