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

urllib.parse.Misimplementation of urljoin #360

Open
SBlechmann opened this issue Nov 26, 2024 · 1 comment
Open

urllib.parse.Misimplementation of urljoin #360

SBlechmann opened this issue Nov 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@SBlechmann
Copy link
Contributor

Describe the bug
The urllib.parse.urljoin, e.g. when using orion base url and the version endpoint in the get_version() function, works a little different than originally expected.

urljoin(url1, url2)

E.g. if orion is running behind "example.org/orion" and I run the get_version, the function will end up querying "example.org/version".
This is because urljoin does not simply concatenate the URLs but cuts the first url depending on how many "/" are part of second url.

To Reproduce
see above, give the orion client a url with a path /orion

Expected behavior
Get version; instead getting nothing cause url is wrong.

@SBlechmann SBlechmann added the bug Something isn't working label Nov 26, 2024
@djs0109
Copy link
Contributor

djs0109 commented Nov 27, 2024

Hi, can you try this code snippet? Make sure you put a trailing slash / at the end of the baseurl.

from urllib.parse import urljoin
base_url = "example.org/orion/"
url = urljoin(base_url, "version")
assert url == "example.org/orion/version"

If it is still an issue, please specify your python environment more specifically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants