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

if path-parameter in functions like replace is a string-like object, the function treats each character as path element #176

Open
con-f-use opened this issue Sep 11, 2021 · 1 comment

Comments

@con-f-use
Copy link

>>> u
DecodedURL(url=URL.from_text('https://example.com/api/v1/webui'))

>>> u.replace(path="support/woo")
DecodedURL(url=URL.from_text('https://example.com/s/u/p/p/o/r/t/%2F/w/o/o''))

I know path is supposed to be an iterable, not a string in this case, i.e. I should have done path=["support", "woo"]. But maybe it would be more user friendly to have the internal logic be something like:

if isinstance(path, str):
    path = path.split('/')
@con-f-use
Copy link
Author

con-f-use commented Sep 11, 2021

Just saw, if I understand correctly, that my example should raise and error:

https://github.com/python-hyper/hyperlink/blob/master/src/hyperlink/_url.py#L1022

Will investigate why it didn't for me. In any case maybe instead of throwing an error, hyperlink should just handle text in path conveniently.

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

1 participant