diff options
Diffstat (limited to 'routers/api/v1/repo/repo.go')
-rw-r--r-- | routers/api/v1/repo/repo.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index 48ace3a8e0..36cc03f893 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -970,9 +970,11 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error { } } - if err := repo_model.UpdateRepositoryUnits(repo, units, deleteUnitTypes); err != nil { - ctx.Error(http.StatusInternalServerError, "UpdateRepositoryUnits", err) - return err + if len(units)+len(deleteUnitTypes) > 0 { + if err := repo_model.UpdateRepositoryUnits(repo, units, deleteUnitTypes); err != nil { + ctx.Error(http.StatusInternalServerError, "UpdateRepositoryUnits", err) + return err + } } log.Trace("Repository advanced settings updated: %s/%s", owner.Name, repo.Name) |