-
Notifications
You must be signed in to change notification settings - Fork 1.5k
sqlite3: Add test case with database path contains whitespace #500
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR and tests!
database/sqlite3/sqlite3.go
Outdated
return nil, err | ||
} | ||
dbfile := strings.Replace(migrate.FilterCustomQuery(purl).String(), "sqlite3://", "", 1) | ||
dbfile, err = nurl.QueryUnescape(dbfile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole connection string cannot be unescaped as the options need to be escaped.
I think we'll need to reconstruct the connection string w/ the host & path unescaped unless you can think of a cleaner way...
Example of what the parsed connection string looks like
e540d4f
to
ff84451
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nice find with the file:
prefix!
I agree with you and think there's still value in testing opening paths with spaces in them.
446b7f8
to
0051a19
Compare
Thanks for the suggestion! Already modified the code. |
Fix #499
Since URL will be encoded using percent-encoding in
migrate/database/sqlite3/sqlite3.go
Line 95 in 550193e
url
like/path/to database/
(it contains whitespace) will be encoded to/path/to%20database/
, which causesmigrate/database/sqlite3/sqlite3.go
Line 47 in 550193e
to return an error.