Gogs version
0.14.2
Git version
- Server: 2.47.3
- Client: 2.52.0
Operating system
MacOS 26.3.1 (25D2128)
Database
SQLite 3
Describe the bug
Creeate or update file endpoint /api/v1/repos/{owner}/{repo}/contents/{path} has edge-case which results in 500 server error.
To reproduce
- Create a repository
- Create
master branch with README.md
- Create branch
feature from master branch content
- Use endpoint
/api/v1/repos/{owner}/{repo}/contents/{path} to upload TEST.md to feature branch
Actual behaviour:
500 server error
2026/03/23 20:23:53 [ERROR] [...al/route/api/v1/repo/contents.go:209 PutContents()] updating repository file: branch already exists [name: feature]
Expected behavior
Create file, 2xx response, no issue.
Additional context
No response
Code of Conduct
Gogs version
0.14.2
Git version
Operating system
MacOS 26.3.1 (25D2128)
Database
SQLite 3
Describe the bug
Creeate or update file endpoint
/api/v1/repos/{owner}/{repo}/contents/{path}has edge-case which results in 500 server error.To reproduce
masterbranch withREADME.mdfeaturefrommasterbranch content/api/v1/repos/{owner}/{repo}/contents/{path}to uploadTEST.mdtofeaturebranchActual behaviour:
500 server error
Expected behavior
Create file, 2xx response, no issue.
Additional context
No response
Code of Conduct