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

Generated installation URL for PyPI repository packages has an escaping problem #23980

Closed
Gunzinger opened this issue Apr 7, 2023 · 3 comments
Labels
topic/ui Change the appearance of the Gitea UI type/bug

Comments

@Gunzinger
Copy link
Contributor

Description

Hi dear gitea maintainers!

First off: Thank you for the great software, I am enjoying it a lot and it saves a lot of resources on my VPS compared to GitLab which I was using previously!

Now to the bug:
There seems to be a problem in the URL escaping of the gitea-origin-url templates, in which the space is url-escaped to %20 when it should remain a space.

Reproduction of the bug in the demo site: https://try.gitea.io/test-pypi-url-bug/-/packages/pypi/pypi-url-test/0.1.0

Might have been introduced in this commit: e7ef94e

Screenshots

demo instance screenshot

Gitea Version

1.19.0 (official docker container)

Can you reproduce the bug on the Gitea demo site?

Yes

Operating System

Windows 10

Browser Version

Firefox 111.0.1

@Gunzinger Gunzinger added type/bug topic/ui Change the appearance of the Gitea UI labels Apr 7, 2023
@Gunzinger
Copy link
Contributor Author

Gunzinger commented Apr 7, 2023

Working on a PR, I think this is an easy fix by adjusting the pypi.tmpl and allows for the addition of a trailing slash to the repository URL in accordance to PEP-503.

EDIT:
As can be seen below, the PR is now ready.
I took a quick look through the other templates in the blamed commit, and none of them seem to have a space inside the data-url attribute of the gitea-origin-url element, which leads me to believe the PyPI link is the only one to be affected.

@silverwind
Copy link
Member

silverwind commented Apr 7, 2023

Is this suffix supposed to be part of the URL? If yes, the escaping would be correct.

Edit: I guess I am wrong 😉

@Gunzinger
Copy link
Contributor Author

Gunzinger commented Apr 7, 2023

For anybody stumbling upon this, the suffix in this case is the package name, and as such not part of the URL, thanks for the approve (being curious is far away from being wrong) :)

silverwind pushed a commit that referenced this issue Apr 8, 2023
#23981)

…; add trailing slash to PyPI repository URL (in accordance to PEP-503)

This should solve Issue #23980, by moving the space in front of the
package name and the package name out of the `gitea-origin-url` block.
It also adds a trailing slash to the PyPI repository URL in accordance
to [Python PEP-503](https://peps.python.org/pep-0503/).

Co-authored-by: Lunny Xiao <[email protected]>
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Apr 8, 2023
go-gitea#23981)

…; add trailing slash to PyPI repository URL (in accordance to PEP-503)

This should solve Issue go-gitea#23980, by moving the space in front of the
package name and the package name out of the `gitea-origin-url` block.
It also adds a trailing slash to the PyPI repository URL in accordance
to [Python PEP-503](https://peps.python.org/pep-0503/).

Co-authored-by: Lunny Xiao <[email protected]>
KN4CK3R pushed a commit that referenced this issue Apr 8, 2023
#23981) (#24008)

Backport #23981 by @Gunzinger

…; add trailing slash to PyPI repository URL (in accordance to PEP-503)

This should solve Issue #23980, by moving the space in front of the
package name and the package name out of the `gitea-origin-url` block.
It also adds a trailing slash to the PyPI repository URL in accordance
to [Python PEP-503](https://peps.python.org/pep-0503/).

Co-authored-by: Daniel Gunzinger <[email protected]>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/ui Change the appearance of the Gitea UI type/bug
Projects
None yet
Development

No branches or pull requests

2 participants