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

Links on /about may lead somewhere else #13872

Closed
2 tasks done
kytta opened this issue Feb 14, 2025 · 1 comment · Fixed by #13873
Closed
2 tasks done

Links on /about may lead somewhere else #13872

kytta opened this issue Feb 14, 2025 · 1 comment · Fixed by #13873
Assignees
Labels
bug Something is broken.
Milestone

Comments

@kytta
Copy link

kytta commented Feb 14, 2025

Describe the issue

On the /about/ page, links to the dependencies may lead to wrong pages. For example. on Hosted Weblate, link to ruamel.yaml leads to the project called Documentation.

I already tried

  • I've read and searched the documentation.
  • I've searched for similar filed issues in this repository.

Steps to reproduce the behavior

  1. Go to https://hosted.weblate.org/about/
  2. Scroll down to "Weblate is built on libre software" and click on ruamel.yaml
  3. You are redirected to a different PyPI package

Expected behavior

You are redirected to ruamel.yaml to PyPI

Screenshots

No response

Exception traceback

How do you run Weblate?

weblate.org service

Weblate versions

No response

Weblate deploy checks

Additional context

This happens because of this code:

def get_version_module(name, optional=False):
"""
Return module object.
On error raises verbose exception with name and URL.
"""
try:
package = metadata(name)
except PackageNotFoundError as exc:
if optional:
return None
msg = f"Missing dependency {name}, please install using: pip install {name}"
raise ImproperlyConfigured(msg) from exc
url = package.get("Home-page")
if url is None and (project_urls := package.get_all("Project-URL")):
for project_url in project_urls:
name, current_url = project_url.split(",", 1)
if name.lower().strip() == "homepage":
url = current_url.strip()
break
if url is None:
url = f"https://pypi.org/project/{name}/"
return (
package.get("Name"),
url,
package.get("Version"),
)

When we enter the method, name is the name of the package. If, however, we don't find a Home-page metadata entry, nor any Project-URL titled "homepage", we end up on line 100 with name now equalling the last parsed Project-URL title. For ruamel.yaml, it's "Documentation".

I can provide a fix PR later today

@nijel nijel self-assigned this Feb 14, 2025
@nijel nijel added the bug Something is broken. label Feb 14, 2025
@nijel nijel added this to the 5.10.1 milestone Feb 14, 2025
nijel added a commit to nijel/weblate that referenced this issue Feb 14, 2025
Avoid overwriting package name by inner loop.

Fixes WeblateOrg#13872
@nijel nijel closed this as completed in 1dd9219 Feb 14, 2025
Copy link

Thank you for your report; the issue you have reported has just been fixed.

  • In case you see a problem with the fix, please comment on this issue.
  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

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

Successfully merging a pull request may close this issue.

2 participants