-
Notifications
You must be signed in to change notification settings - Fork 608
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
fix(uri-parsing): handle password with bracket in connection url #9466
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 putting this in @grieve54706 !
I marked a few spots that are causing the CI failures
ibis/backends/snowflake/__init__.py
Outdated
@@ -17,7 +17,7 @@ | |||
from pathlib import Path | |||
from typing import TYPE_CHECKING, Any | |||
from urllib.parse import parse_qs, urlparse | |||
from urllib.request import urlretrieve | |||
from urllib.request import unquote_plus, urlretrieve |
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.
I think most of the CI failures stem from this import, which should be from urllib.parse
ibis/backends/clickhouse/__init__.py
Outdated
@@ -82,7 +82,7 @@ def _from_url(self, url: str, **kwargs) -> BaseBackend: | |||
|
|||
connect_args = { | |||
"user": url.username, | |||
"password": url.password or "", | |||
"password": unquote_plus(url.password) or "", |
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 password
attribute can be None
depending on the connection string, so there needs to be a None
check before calling unquote_plus
@gforsyth Thanks for your suggestion. You saved my life. |
aa85ca4
to
4e7d1dd
Compare
4e7d1dd
to
b09c1fb
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.
LGTM, I'll do a few cleanups of the excepting string matching in #9482
@grieve54706 @gforsyth Is there a corresponding issue for this PR? NBD if not, just wondering! |
I don't think there was |
Nope. Thank you for your time. |
Description of changes
If the password is with a bracket in the connection url,
urllib.parse.urlparse(url)
will raise the errorValueError: Invalid IPv6 URL
inbackends.connect()
. But if the caller quotes the password to avoid parsing failing, ibis does not unquote back the password.Reproducible example