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

Authentication error on credentials with the character '#' #170

Closed
gustavoalves23 opened this issue May 18, 2024 · 1 comment
Closed

Authentication error on credentials with the character '#' #170

gustavoalves23 opened this issue May 18, 2024 · 1 comment

Comments

@gustavoalves23
Copy link

I am facing a issue where, when the DB connection URL has the character '#' on it, the URL is splited on this character, causing the authentication to fail.

I tried this on SQL Server, but i believe happens on other adapters.

Expected Behavior

Be able to authenticate on DBs with # on its password.

Current Behavior

DB refuses to authenticate because the password sent is wrong

Possible Solution

After some debug, i found out this line:

let url = substitute(url, '#.*', '', '')

Because of that, its removing everything after some '#'

Looks like the # character is related to something called fragment:

return matchstr(a:url, '#\zs.*')

But i don't know exacly what is it purpose.

i made a fork that just remove some lines related to them and fixed the problem for me, but probably broke something related to those fragments.

Steps to Reproduce

  1. Add the vim-dadbod plugin on vim.
  2. Run a container with sql server: docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=12345678#abc@" -e "MSSQL_PID=Evaluation" -p 1433:1433 --hostname sqlpreview -d mcr.microsoft.com/mssql/server:2022-preview-ubuntu-22.04
  3. Try to connect with the connection url: sqlserver://localhost:1433;user=sa;password=12345678#abc@
  4. It will fail, try to redo steps 2 and 3 but without the # on the password and it will work
@tpope
Copy link
Owner

tpope commented May 18, 2024

Use %23.

Special characters in URL fields must be URL escaped. For example, if the
user is "me@example.com", and the password is "my#password?", the URL might
look like this:
>
mysql://me%40example.com:my%23password%3F@localhost/database

@tpope tpope closed this as completed May 18, 2024
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

No branches or pull requests

2 participants