Improve NuGet API Parity (#21291) (#34940)

Fixes #21291, allowing icons and other missing attributes to appear for
NuGet packages from inside Visual Studio like they do with GitHub Nuget
packages.

Adds additional NuGet package information, particularly `IconURL`, to
bring the Gitea NuGet API more in-line with GitHub's NuGet API.

ref: https://learn.microsoft.com/en-us/nuget/api/search-query-service-resource
此提交包含在:
Scion
2025-07-07 10:43:58 +00:00
提交者 GitHub
父節點 ddfa2e4a3e
當前提交 f88800d545
共有 4 個檔案被更改,包括 184 行新增59 行删除
+8
查看文件
@@ -37,6 +37,14 @@ type PackageVersion struct {
DownloadCount int64 `xorm:"NOT NULL DEFAULT 0"`
}
// IsPrerelease checks if the version is a prerelease version according to semantic versioning
func (pv *PackageVersion) IsPrerelease() bool {
if pv == nil || pv.Version == "" {
return false
}
return strings.Contains(pv.Version, "-")
}
// GetOrInsertVersion inserts a version. If the same version exist already ErrDuplicatePackageVersion is returned
func GetOrInsertVersion(ctx context.Context, pv *PackageVersion) (*PackageVersion, error) {
e := db.GetEngine(ctx)