summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2023-10-24 15:40:02 +0800
committerGitHub <noreply@github.com>2023-10-24 15:40:02 +0800
commit77bd3acb65f88891af3a57e2521ce91108bd2f5c (patch)
treeac47dadd2bbf40b249abdafa52f4a900011f9238 /routers
parent95db95ef91f50b2960e568161d29ada7eaafd573 (diff)
downloadgitea-77bd3acb65f88891af3a57e2521ce91108bd2f5c.tar.gz
gitea-77bd3acb65f88891af3a57e2521ce91108bd2f5c.zip
Do not force creation of _cargo-index repo on publish (#27266) (#27765)
Backport #27266 by @merlleu Hello there, Cargo Index over HTTP is now prefered over git for package updates: we should not force users who do not need the GIT repo to have the repo created/updated on each publish (it can still be created in the packages settings). The current behavior when publishing is to check if the repo exist and create it on the fly if not, then update it's content. Cargo HTTP Index does not rely on the repo itself so this will be useless for everyone not using the git protocol for cargo registry. This PR only disable the creation on the fly of the repo when publishing a crate. This is linked to #26844 (error 500 when trying to publish a crate if user is missing write access to the repo) because it's now optional. Co-authored-by: merlleu <r.langdorph@gmail.com> Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Diffstat (limited to 'routers')
-rw-r--r--routers/api/packages/cargo/cargo.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/routers/api/packages/cargo/cargo.go b/routers/api/packages/cargo/cargo.go
index 225b6b5ade..8f1e965c9a 100644
--- a/routers/api/packages/cargo/cargo.go
+++ b/routers/api/packages/cargo/cargo.go
@@ -250,7 +250,7 @@ func UploadPackage(ctx *context.Context) {
return
}
- if err := cargo_service.AddOrUpdatePackageIndex(ctx, ctx.Doer, ctx.Package.Owner, pv.PackageID); err != nil {
+ if err := cargo_service.UpdatePackageIndexIfExists(ctx, ctx.Doer, ctx.Package.Owner, pv.PackageID); err != nil {
if err := packages_service.DeletePackageVersionAndReferences(ctx, pv); err != nil {
log.Error("Rollback creation of package version: %v", err)
}
@@ -301,7 +301,7 @@ func yankPackage(ctx *context.Context, yank bool) {
return
}
- if err := cargo_service.AddOrUpdatePackageIndex(ctx, ctx.Doer, ctx.Package.Owner, pv.PackageID); err != nil {
+ if err := cargo_service.UpdatePackageIndexIfExists(ctx, ctx.Doer, ctx.Package.Owner, pv.PackageID); err != nil {
apiError(ctx, http.StatusInternalServerError, err)
return
}