Skip to content
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

Bugs about URL and percent-encoded ASCII string #597

Closed
biluohc opened this issue Aug 1, 2020 · 1 comment · Fixed by #650
Closed

Bugs about URL and percent-encoded ASCII string #597

biluohc opened this issue Aug 1, 2020 · 1 comment · Fixed by #650

Comments

@biluohc
Copy link

biluohc commented Aug 1, 2020

Sqlx's Version: 0.4.0-beta.1 and master.

Sqlx can't connect to DATABASE if the URL's password contains special characters that needs url-encoding now.

Maybe should use percent_encoding to decode it.

I use MySQL, buts other databases also have this problem.

https://github.com/launchbadge/sqlx/blob/master/sqlx-core/src/mysql/options/parse.rs#L26

pub fn query(&self) -> Option<&str>
Return the password for this URL, if any, as a percent-encoded ASCII string.

string in .env:  DATABASE_URL=mysql://root:Q3Mjg=@127.0.0.1/templatedb
Parsed URL: mysql://root:Q3Mjg%3D@127.0.0.1/templatedb
password: Q3Mjg%3D
Error:  error returned from database: 1045 (28000): Access denied for user 'root'@'172.17.0.1' (using password: YES)

Some other attributes of the URL are also like it, may have to watch for them, but the password easiest to have special characters.

Thanks.

@biluohc biluohc changed the title Bugs about URL with percent-encoded ASCII string Bugs about URL and percent-encoded ASCII string Aug 1, 2020
@pymongo
Copy link
Contributor

pymongo commented Aug 2, 2020

Fix in PR #630

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 a pull request may close this issue.

2 participants