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

Refactor: Ensure usage of get_absolute_url doesn't mix in scheme and domain #10371

Open
benjaoming opened this issue May 31, 2023 · 1 comment
Labels
Improvement Minor improvement to code

Comments

@benjaoming
Copy link
Contributor

In a recent bug, the root nature of the bug is the unconventional usage of Django's get_absolute_url() Model method. Despite fixing the bug, we chose to leave the broken pattern in place so the extend of the bug fix didn't go further.

This comment thread illustrates the issue and confusion: #10369 (comment)

get_absolute_url() should always return a URL that's relative to the current website, and all other usages and contracts should be deferred to a different method: We have used get_docs_url for instance when full {scheme}://{domain}{path} URLs are used on Project.

See: #10369

@benjaoming
Copy link
Contributor Author

Since this is specifically addressing Version.get_absolute_url, we should consider returning a RedirectView in order to have support for same-site public URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Minor improvement to code
Projects
None yet
Development

No branches or pull requests

1 participant