mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	- Change condition to include `RepoID` equal to 0 for organization secrets Backport https://github.com/go-gitea/gitea/pull/31715 by @appleboy Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
		@@ -116,12 +116,11 @@ func (Action) CreateOrUpdateSecret(ctx *context.APIContext) {
 | 
				
			|||||||
	//   "404":
 | 
						//   "404":
 | 
				
			||||||
	//     "$ref": "#/responses/notFound"
 | 
						//     "$ref": "#/responses/notFound"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	owner := ctx.Repo.Owner
 | 
					 | 
				
			||||||
	repo := ctx.Repo.Repository
 | 
						repo := ctx.Repo.Repository
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	opt := web.GetForm(ctx).(*api.CreateOrUpdateSecretOption)
 | 
						opt := web.GetForm(ctx).(*api.CreateOrUpdateSecretOption)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	_, created, err := secret_service.CreateOrUpdateSecret(ctx, owner.ID, repo.ID, ctx.Params("secretname"), opt.Data)
 | 
						_, created, err := secret_service.CreateOrUpdateSecret(ctx, 0, repo.ID, ctx.Params("secretname"), opt.Data)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		if errors.Is(err, util.ErrInvalidArgument) {
 | 
							if errors.Is(err, util.ErrInvalidArgument) {
 | 
				
			||||||
			ctx.Error(http.StatusBadRequest, "CreateOrUpdateSecret", err)
 | 
								ctx.Error(http.StatusBadRequest, "CreateOrUpdateSecret", err)
 | 
				
			||||||
@@ -173,10 +172,9 @@ func (Action) DeleteSecret(ctx *context.APIContext) {
 | 
				
			|||||||
	//   "404":
 | 
						//   "404":
 | 
				
			||||||
	//     "$ref": "#/responses/notFound"
 | 
						//     "$ref": "#/responses/notFound"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	owner := ctx.Repo.Owner
 | 
					 | 
				
			||||||
	repo := ctx.Repo.Repository
 | 
						repo := ctx.Repo.Repository
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err := secret_service.DeleteSecretByName(ctx, owner.ID, repo.ID, ctx.Params("secretname"))
 | 
						err := secret_service.DeleteSecretByName(ctx, 0, repo.ID, ctx.Params("secretname"))
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		if errors.Is(err, util.ErrInvalidArgument) {
 | 
							if errors.Is(err, util.ErrInvalidArgument) {
 | 
				
			||||||
			ctx.Error(http.StatusBadRequest, "DeleteSecret", err)
 | 
								ctx.Error(http.StatusBadRequest, "DeleteSecret", err)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user