0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-01-24 17:26:51 +01:00
This commit is contained in:
Excellencedev 2025-12-26 11:23:32 +01:00
parent c7d20802af
commit 26e47a58ef

View File

@ -109,7 +109,11 @@ func reqPackageAccess(accessMode perm.AccessMode) func(ctx *context.Context) {
// If package is not linked to any repo (org-level package), deny access from Actions
// Actions tokens should only access packages linked to repos
if packageRepoID == 0 {
fmt.Printf("DEBUG: packageRepoID is 0 for pkgID %d. Denying access.\n", ctx.Package.Descriptor.Package.ID)
pkgID := int64(0)
if ctx.Package.Descriptor != nil && ctx.Package.Descriptor.Package != nil {
pkgID = ctx.Package.Descriptor.Package.ID
}
fmt.Printf("DEBUG: packageRepoID is 0 for pkgID %d. Denying access.\n", pkgID)
ctx.HTTPError(http.StatusForbidden, "reqPackageAccess", "Actions tokens cannot access packages not linked to a repository")
return
}