diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-03-03 01:38:38 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-02 17:38:38 +0000 |
commit | bf6502a8f7a2e9a2b64b43b7733316d863c9a768 (patch) | |
tree | 4b06bddb42d4c5a01c7abbada2824d2eec0bbee4 /routers/api/packages | |
parent | 70c126e6184872a6ac63cae2f327fc745b25d1d7 (diff) | |
download | gitea-bf6502a8f7a2e9a2b64b43b7733316d863c9a768.tar.gz gitea-bf6502a8f7a2e9a2b64b43b7733316d863c9a768.zip |
Fix incorrect relative/absolute URL usages (#29531)
Add two "HTMLURL" methods for PackageDescriptor.
And rename "FullWebLink" to "VersionWebLink"
Diffstat (limited to 'routers/api/packages')
-rw-r--r-- | routers/api/packages/npm/api.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/routers/api/packages/npm/api.go b/routers/api/packages/npm/api.go index 8470874884..f8e839c424 100644 --- a/routers/api/packages/npm/api.go +++ b/routers/api/packages/npm/api.go @@ -12,6 +12,7 @@ import ( packages_model "code.gitea.io/gitea/models/packages" npm_module "code.gitea.io/gitea/modules/packages/npm" + "code.gitea.io/gitea/modules/setting" ) func createPackageMetadataResponse(registryURL string, pds []*packages_model.PackageDescriptor) *npm_module.PackageMetadata { @@ -98,7 +99,7 @@ func createPackageSearchResponse(pds []*packages_model.PackageDescriptor, total Maintainers: []npm_module.User{}, // npm cli needs this field Keywords: metadata.Keywords, Links: &npm_module.PackageSearchPackageLinks{ - Registry: pd.FullWebLink(), + Registry: setting.AppURL + "api/packages/" + pd.Owner.Name + "/npm", Homepage: metadata.ProjectURL, }, }, |