API: PATCH api/v1/repos/{username}/{reponame} does not work when repo is empty #7240

Closed
opened 2025-11-02 07:20:37 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @jpraet on GitHub (Apr 23, 2021).

Originally assigned to: @6543 on GitHub.

  • Gitea version (or commit ref): 1.14.1
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No

Description

curl -X 'PATCH' \
  'http://localhost:3000/api/v1/repos/jpraet/test?token=*' \
  -H 'accept: application/json' \
  -H 'authorization: Basic anByYWV0OmZlY2t5b3Uy' \
  -H 'Content-Type: application/json' \
  -d '{
  "has_pull_requests": true,
  "allow_rebase": false
}'

This returns an empty HTTP 200 response, but the changes were not applied.
This is for an empty repository. It works correctly on a non-empty repo.
This is a regression in 1.14, it works on 1.13.

I think the issue may be here:

https://github.com/go-gitea/gitea/blob/master/modules/context/api.go#L281-L284

Originally created by @jpraet on GitHub (Apr 23, 2021). Originally assigned to: @6543 on GitHub. - Gitea version (or commit ref): 1.14.1 - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) - [ ] No ## Description ``` curl -X 'PATCH' \ 'http://localhost:3000/api/v1/repos/jpraet/test?token=*' \ -H 'accept: application/json' \ -H 'authorization: Basic anByYWV0OmZlY2t5b3Uy' \ -H 'Content-Type: application/json' \ -d '{ "has_pull_requests": true, "allow_rebase": false }' ``` This returns an empty HTTP 200 response, but the changes were not applied. This is for an **empty** repository. It works correctly on a non-empty repo. This is a regression in 1.14, it works on 1.13. I think the issue may be here: https://github.com/go-gitea/gitea/blob/master/modules/context/api.go#L281-L284
GiteaMirror added the issue/regressionmodifies/api labels 2025-11-02 07:20:37 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7240