Skip to content

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

Closed
@TobiX

Description

@TobiX

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions