feat(packages): expose package file properties in the package files API (#40066)

Package files carry type specific properties like `debian.distribution`,
`debian.component`, `rpm.group` or `alpine.branch` that decide where a
file lives in a registry, but the API never returned them. A client
listing `GET /packages/{owner}/{type}/{name}/{version}/files` could not
tell which distribution or component a file belongs to, or tell apart
same-named files in different ones. Tools copying packages between
instances, like https://gitea.com/gitea/importer, need them to re-upload
a file to the same place.

This adds a `properties` map to `PackageFile`, limited to the properties
that locate a file. Internal ones like the rpm, alpine, arch and conda
metadata or the Debian control file stay hidden, as they can be many MiB
per file.

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
authored and GitHub committed 2026-10-29 18:10:36 +00:00
1 parent eb9267365d
commit b0b31bc593
18 files changed
+225 -2

No files matched your search

+2
View File
@@ -46,4 +46,6 @@ type PackageFile struct {
HashSHA256 string `json:"sha256"`
// The SHA512 hash of the package file
HashSHA512 string `json:"sha512"`
// The type specific properties locating the package file, e.g. the distribution and component of a Debian package
Properties map[string]string `json:"properties,omitempty"`
}