Skip to content

API PATCH ​/repos​/{owner}​/{repo} changes repo units (wiki, tracker) even if not set #7758

Closed
@davidsvantesson

Description

@davidsvantesson
  • Gitea version (or commit ref): 1.10.0+dev-136-g52feff5a5
  • Git version: Not relevant
  • Operating system: Ubuntu
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

API: PATCH "​/repos​/{owner}​/{repo}" has the following description:
"Edit a repository's properties. Only fields that are set will be changed."
When executing the API without for example "has_wiki" in the body, the wiki is disabled. Similar for other repo units.

I think this is because function UpdateRepositoryUnits in models/repo.go delete all repo_units for the specified repo_id and then inserts the set repo units again. While the function updateRepoUnits in api/v1/repo/repo.go only adds those repo_units it wants to change.
I am not sure if the change should be in the model or in the api function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions