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

Importing maven pom XML that's not UTF-8 encoded creates broken package #25853

Closed
TobiX opened this issue Jul 12, 2023 · 1 comment · Fixed by #25873
Closed

Importing maven pom XML that's not UTF-8 encoded creates broken package #25853

TobiX opened this issue Jul 12, 2023 · 1 comment · Fixed by #25873

Comments

@TobiX
Copy link

TobiX commented Jul 12, 2023

Description

When trying to mirror some old packages into a maven repository, we ran into an error when trying to upload ISO-8859-1-encoded pom XML files:

2023/07/10 16:54:52 ...kages/maven/maven.go:328:UploadPackageFile() [E] [64ac1bbc-4] Error parsing package metadata: xml: encoding "ISO-8859-1" declared but Decoder.CharsetReader is nil

While this will probably not happen with modern Maven versions, one might run into this problem when trying to cache/host old artifacts inside Gitea.

To Reproduce

  1. Get commons-jxpath-1.3 jar and pom from https://repo1.maven.org/maven2/commons-jxpath/commons-jxpath/1.3/
  2. Try to deploy to Gitea: mvn deploy:deploy-file -Dfile=commons-jxpath-1.3.jar -DrepositoryId=gitea -Durl=https://try.gitea.io/api/packages/encoding/maven -DpomFile=commons-jxpath-1.3.pom
  3. Receive 500 Internal Server Error (https://gist.github.com/TobiX/08ba809cb6d27df8aa5e85d0f3633b01)
  4. Repository view is now also broken: https://try.gitea.io/encoding/-/packages/maven/commons-jxpath-commons-jxpath/1.3

Gitea Version

1.19.4

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

grafik

Git Version

2.39.2

Operating System

Debian 12 (bookworm)

How are you running Gitea?

Database

PostgreSQL

@KN4CK3R
Copy link
Member

KN4CK3R commented Jul 13, 2023

Thank you for the report. Fixed in #25873. To get rid of the 500 error you have to delete the package. Visit the package url + /settings to delete it or use the admin panel.

silverwind pushed a commit that referenced this issue Jul 14, 2023
Fixes #25853

- Maven POM files aren't always UTF-8 encoded.
- Reject the upload of unparsable POM files
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Jul 14, 2023
Fixes go-gitea#25853

- Maven POM files aren't always UTF-8 encoded.
- Reject the upload of unparsable POM files
silverwind pushed a commit that referenced this issue Jul 14, 2023
Backport #25873 by @KN4CK3R

Fixes #25853

- Maven POM files aren't always UTF-8 encoded.
- Reject the upload of unparsable POM files

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants