Description
Description
After upgrading gitea to version 1.19.0 the my script via API can't protect branches anymore.
- Tried creating the branch protection manually via user interface - worked
- Creating branch protection via swagger worked too
- Creating branch protection via API - doesn't work
Simply run the bash script to put protection on master:
curl -X 'POST' \ "https://gitea.com/api/v1/repos/projects/project/branch_protections?token=KEY" \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "branch_name": "master" }'
Gitea Version
1.19
Can you reproduce the bug on the Gitea demo site?
No, can't find token key
Log Gist
2023/04/06 09:30:56 [642e9150-3] router: completed DELETE /api/v1/repos/projects/demo/branch_protections/master for ip:0, 404 Not Found in 24.8ms @ repo/branch.go:856(repo.DeleteBranchProtection) 2023/04/06 09:30:57 [642e9151-2] router: completed DELETE /api/v1/repos/projects/demo/branch_protections/develop for ip:0, 404 Not Found in 25.9ms @ repo/branch.go:856(repo.DeleteBranchProtection) 2023/04/06 09:30:57 [642e9151-4] router: completed POST /api/v1/repos/projects/demo/branch_protections for ip:0, 201 Created in 134.2ms @ repo/branch.go:384(repo.CreateBranchProtection) 2023/04/06 09:30:58 ...pi/v1/repo/branch.go:532:CreateBranchProtection() [E] [642e9152] UpdateProtectBranch: Insert: pq: duplicate key value violates unique constraint "UQE_protected_branch_s" 2023/04/06 09:30:58 [642e9152] router: completed POST /api/v1/repos/projects/demo/branch_protections for ip:0, 500 Internal Server Error in 46.2ms @ repo/branch.go:384(repo.CreateBranchProtection)
Screenshots
Git Version
git version 2.38.4
Operating System
Linux 3e9cf1c58088 5.4.0-122-generic #138-Ubuntu
How are you running Gitea?
Docker image
Database
PostgreSQL