diff --git a/go.mod b/go.mod index 3e7e0f3b31..cbeed64369 100644 --- a/go.mod +++ b/go.mod @@ -152,7 +152,7 @@ require ( github.com/caddyserver/zerossl v0.1.3 // indirect github.com/cention-sany/utf7 v0.0.0-20170124080048-26cad61bd60a // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/cloudflare/circl v1.3.8 // indirect + github.com/cloudflare/circl v1.6.1 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect github.com/cyphar/filepath-securejoin v0.3.6 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect diff --git a/go.sum b/go.sum index 39743b14e1..1a285735a0 100644 --- a/go.sum +++ b/go.sum @@ -150,8 +150,8 @@ github.com/chromedp/sysutil v1.0.0/go.mod h1:kgWmDdq8fTzXYcKIBqIYvRRTnYb9aNS9moA github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= -github.com/cloudflare/circl v1.3.8 h1:j+V8jJt09PoeMFIu2uh5JUyEaIHTXVOHslFoLNAKqwI= -github.com/cloudflare/circl v1.3.8/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU= +github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0= +github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc= github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= diff --git a/routers/api/v1/repo/migrate.go b/routers/api/v1/repo/migrate.go index d0ab5e270e..75e772dfe2 100644 --- a/routers/api/v1/repo/migrate.go +++ b/routers/api/v1/repo/migrate.go @@ -224,9 +224,8 @@ func Migrate(ctx *context.APIContext) { HasWiki: &opts.Wiki, } - // only enabling wiki could return an error - if err = updateRepoUnits(ctx, repoOpt); err != nil { - log.Error("Failed to enable wiki on %s/%s repo. %w", repoOwner.Name, form.RepoName, err) + if err = updateRepoUnits(ctx, repoOwner.Name, repo, repoOpt); err != nil { + log.Error("Failed to update units on %s/%s repo. %w", repoOwner.Name, form.RepoName, err) } } diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index 59b32eb667..e8c3965ff3 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -647,7 +647,7 @@ func Edit(ctx *context.APIContext) { return } - if err := updateRepoUnits(ctx, opts); err != nil { + if err := updateRepoUnits(ctx, ctx.Repo.Owner.Name, ctx.Repo.Repository, opts); err != nil { return } @@ -779,10 +779,7 @@ func updateBasicProperties(ctx *context.APIContext, opts api.EditRepoOption) err } // updateRepoUnits updates repo units: Issue settings, Wiki settings, PR settings -func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error { - owner := ctx.Repo.Owner - repo := ctx.Repo.Repository - +func updateRepoUnits(ctx *context.APIContext, owner string, repo *repo_model.Repository, opts api.EditRepoOption) error { var units []repo_model.RepoUnit var deleteUnitTypes []unit_model.Type @@ -1045,7 +1042,7 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error { } } - log.Trace("Repository advanced settings updated: %s/%s", owner.Name, repo.Name) + log.Trace("Repository advanced settings updated: %s/%s", owner, repo.Name) return nil } diff --git a/tests/integration/api_repo_test.go b/tests/integration/api_repo_test.go index cd79c6eee6..d00b6feb66 100644 --- a/tests/integration/api_repo_test.go +++ b/tests/integration/api_repo_test.go @@ -396,6 +396,7 @@ func TestAPIRepoMigrate(t *testing.T) { CloneAddr: testCase.cloneURL, RepoOwnerID: testCase.userID, RepoName: testCase.repoName, + Wiki: true, }).AddTokenAuth(token) resp := MakeRequest(t, req, NoExpectedStatus) if resp.Code == http.StatusUnprocessableEntity {