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

Server generated links can contain multiple forward slashes #122

Open
paul121 opened this issue Dec 30, 2022 · 0 comments
Open

Server generated links can contain multiple forward slashes #122

paul121 opened this issue Dec 30, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@paul121
Copy link
Member

paul121 commented Dec 30, 2022

If settings.SERVER_HOST contains a trailing forward slash then links a generated with a duplicate forward slash, breaking the link. I've seen this for authorization links, registration links and reset password links in utils.py :

server_host = settings.SERVER_HOST
link = f"{server_host}/authorize-farm/?farm_id={farm_id}&api_token={token.decode()}"

It may be easiest to validate settings.SERVER_HOST to always have a trailing /. Then we can use urllib.parse.urljoin(base, url) to build the link.

@paul121 paul121 added the bug Something isn't working label Dec 30, 2022
@paul121 paul121 self-assigned this Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant