Skip to content

Commit e563297

Browse files
authored
fix(api): owner ID should be zero when created repo secret (go-gitea#31715) (go-gitea#31811)
- Change condition to include `RepoID` equal to 0 for organization secrets Backport go-gitea#31715 by @appleboy Signed-off-by: Bo-Yi Wu <[email protected]>
1 parent 144648a commit e563297

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

routers/api/v1/repo/action.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,11 @@ func (Action) CreateOrUpdateSecret(ctx *context.APIContext) {
116116
// "404":
117117
// "$ref": "#/responses/notFound"
118118

119-
owner := ctx.Repo.Owner
120119
repo := ctx.Repo.Repository
121120

122121
opt := web.GetForm(ctx).(*api.CreateOrUpdateSecretOption)
123122

124-
_, created, err := secret_service.CreateOrUpdateSecret(ctx, owner.ID, repo.ID, ctx.Params("secretname"), opt.Data)
123+
_, created, err := secret_service.CreateOrUpdateSecret(ctx, 0, repo.ID, ctx.Params("secretname"), opt.Data)
125124
if err != nil {
126125
if errors.Is(err, util.ErrInvalidArgument) {
127126
ctx.Error(http.StatusBadRequest, "CreateOrUpdateSecret", err)
@@ -173,10 +172,9 @@ func (Action) DeleteSecret(ctx *context.APIContext) {
173172
// "404":
174173
// "$ref": "#/responses/notFound"
175174

176-
owner := ctx.Repo.Owner
177175
repo := ctx.Repo.Repository
178176

179-
err := secret_service.DeleteSecretByName(ctx, owner.ID, repo.ID, ctx.Params("secretname"))
177+
err := secret_service.DeleteSecretByName(ctx, 0, repo.ID, ctx.Params("secretname"))
180178
if err != nil {
181179
if errors.Is(err, util.ErrInvalidArgument) {
182180
ctx.Error(http.StatusBadRequest, "DeleteSecret", err)

0 commit comments

Comments
 (0)