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

Can't Connect With Special Characters in Mysql Password #25

Closed
wstewarttennes opened this issue Jan 21, 2024 · 9 comments · Fixed by #36
Closed

Can't Connect With Special Characters in Mysql Password #25

wstewarttennes opened this issue Jan 21, 2024 · 9 comments · Fixed by #36

Comments

@wstewarttennes
Copy link

Not able to connect with special characters or replacing special characters in the password field with their % representation.

@jorgerojas26
Copy link
Owner

Ok, i'll check this. Thanks for the issue.

@jorgerojas26
Copy link
Owner

I found a solution for this. It was just a matter of escaping the url string correctly.

I will make a PR soon.

jorgerojas26 added a commit that referenced this issue Jan 24, 2024
…url-string

Fixes special characters in connection url string. Fixes #25
@pixelskull
Copy link

Not quite sure if it is related to this, when trying to connect to a postgres database I get the error that it could not parse the url:

pg://user:pass@localhost/db_name?sslmode=disable

parse "pg://user:pass@localhost%2Fdb_name?sslmode=disable": invalid URL escape "%2F"

the %2F is obviously the escaped "/". It seems that encoding with the net/url package does not like the schema.

@jorgerojas26
Copy link
Owner

Not quite sure if it is related to this, when trying to connect to a postgres database I get the error that it could not parse the url:

pg://user:pass@localhost/db_name?sslmode=disable

parse "pg://user:pass@localhost%2Fdb_name?sslmode=disable": invalid URL escape "%2F"

the %2F is obviously the escaped "/". It seems that encoding with the net/url package does not like the schema.

The URL encoding/decoding is done internally, please try with the raw connection url string, without the escaped "/".

@jorgerojas26 jorgerojas26 reopened this Jan 31, 2024
@pixelskull
Copy link

Oh sorry, the quote from the earlier post is my input. I entered it without escape, but after saving it seems to be escaped.
Just to be clear, this is my input: pg://user:pass@localhost/db_name?sslmode=disable

@jorgerojas26
Copy link
Owner

jorgerojas26 commented Feb 3, 2024

Ok, the problem here is that it is not parsing correctly your input because of the /db_name, if i put the url without the "/db_name" it works correctly.

I'll work on that.

@pixelskull
Copy link

Thanks for your effort. I am stroked to use this awesome project :)

@jorgerojas26
Copy link
Owner

I'm thinking of reverting the changes i made to do the escaping internally, this adds a lot of unnecessary complexity that could be avoided if the users just escape their connection strings.

I'm working on it, so we can move on to develop other features.

@pixelskull
Copy link

Since the fix was working for passwords, you could slice the user and password section, and use the escaping only for this part. There shouldn't be a case for the url part to be escaped, since every occurrence of a special character here will break the url?!

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.

3 participants