diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2022-11-24 15:25:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-24 16:25:13 +0200 |
commit | fc7a2d5a959334f7195571a3e1db669ed7667a28 (patch) | |
tree | e03df232ebc29e508680686c396cfecb4eeb0902 /routers/api/packages/maven/api.go | |
parent | 26f941fbdac73844a93c902ce6d1144175ff23ed (diff) | |
download | gitea-fc7a2d5a959334f7195571a3e1db669ed7667a28.tar.gz gitea-fc7a2d5a959334f7195571a3e1db669ed7667a28.zip |
Add support for HEAD requests in Maven registry (#21834)
Related #18543
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'routers/api/packages/maven/api.go')
-rw-r--r-- | routers/api/packages/maven/api.go | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/routers/api/packages/maven/api.go b/routers/api/packages/maven/api.go index b60a317814..4ca541dd6f 100644 --- a/routers/api/packages/maven/api.go +++ b/routers/api/packages/maven/api.go @@ -6,7 +6,6 @@ package maven import ( "encoding/xml" - "sort" "strings" packages_model "code.gitea.io/gitea/models/packages" @@ -23,12 +22,8 @@ type MetadataResponse struct { Version []string `xml:"versioning>versions>version"` } +// pds is expected to be sorted ascending by CreatedUnix func createMetadataResponse(pds []*packages_model.PackageDescriptor) *MetadataResponse { - sort.Slice(pds, func(i, j int) bool { - // Maven and Gradle order packages by their creation timestamp and not by their version string - return pds[i].Version.CreatedUnix < pds[j].Version.CreatedUnix - }) - var release *packages_model.PackageDescriptor versions := make([]string, 0, len(pds)) |