diff --git a/go.mod b/go.mod index 0eca1be551..c067228d75 100644 --- a/go.mod +++ b/go.mod @@ -98,7 +98,7 @@ require ( github.com/yohcop/openid-go v1.0.1 github.com/yuin/goldmark v1.7.12 github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc - gitlab.com/gitlab-org/api/client-go v0.129.0 + gitlab.com/gitlab-org/api/client-go v0.130.1 go.uber.org/mock v0.5.2 golang.org/x/crypto v0.39.0 golang.org/x/image v0.27.0 diff --git a/go.sum b/go.sum index 18e37ae5f6..92d7dfabf6 100644 --- a/go.sum +++ b/go.sum @@ -560,8 +560,8 @@ github.com/zeebo/blake3 v0.2.4 h1:KYQPkhpRtcqh0ssGYcKLG1JYvddkEA8QwCM/yBqhaZI= github.com/zeebo/blake3 v0.2.4/go.mod h1:7eeQ6d2iXWRGF6npfaxl2CU+xy2Fjo2gxeyZGCRUjcE= github.com/zeebo/pcg v1.0.1 h1:lyqfGeWiv4ahac6ttHs+I5hwtH/+1mrhlCtVNQM2kHo= github.com/zeebo/pcg v1.0.1/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4= -gitlab.com/gitlab-org/api/client-go v0.129.0 h1:o9KLn6fezmxBQWYnQrnilwyuOjlx4206KP0bUn3HuBE= -gitlab.com/gitlab-org/api/client-go v0.129.0/go.mod h1:ZhSxLAWadqP6J9lMh40IAZOlOxBLPRh7yFOXR/bMJWM= +gitlab.com/gitlab-org/api/client-go v0.130.1 h1:1xF5C5Zq3sFeNg3PzS2z63oqrxifne3n/OnbI7nptRc= +gitlab.com/gitlab-org/api/client-go v0.130.1/go.mod h1:ZhSxLAWadqP6J9lMh40IAZOlOxBLPRh7yFOXR/bMJWM= go.etcd.io/bbolt v1.4.0 h1:TU77id3TnN/zKr7CO/uk+fBCwF2jGcMuw2B/FMAzYIk= go.etcd.io/bbolt v1.4.0/go.mod h1:AsD+OCi/qPN1giOX1aiLAha3o1U8rAz65bvN4j0sRuk= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= diff --git a/package-lock.json b/package-lock.json index 473a334c25..b73bc9099b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ "katex": "0.16.22", "mermaid": "11.6.0", "mini-css-extract-plugin": "2.9.2", - "minimatch": "10.0.1", + "minimatch": "10.0.2", "monaco-editor": "0.52.2", "monaco-editor-webpack-plugin": "7.1.0", "pdfobject": "2.3.0", @@ -11012,12 +11012,12 @@ } }, "node_modules/minimatch": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", - "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.2.tgz", + "integrity": "sha512-+9TJCIYXgZ2Dm5LxVCFsa8jOm+evMwXHFI0JM1XROmkfkpz8/iLLDh+TwSmyIBrs6C6Xu9294/fq8cBA+P6AqA==", "license": "ISC", "dependencies": { - "brace-expansion": "^2.0.1" + "brace-expansion": "^4.0.1" }, "engines": { "node": "20 || >=22" @@ -11026,6 +11026,27 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/minimatch/node_modules/balanced-match": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-3.0.1.tgz", + "integrity": "sha512-vjtV3hiLqYDNRoiAv0zC4QaGAMPomEoq83PRmYIofPswwZurCeWR5LByXm7SyoL0Zh5+2z0+HC7jG8gSZJUh0w==", + "license": "MIT", + "engines": { + "node": ">= 16" + } + }, + "node_modules/minimatch/node_modules/brace-expansion": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-4.0.1.tgz", + "integrity": "sha512-YClrbvTCXGe70pU2JiEiPLYXO9gQkyxYeKpJIQHVS/gOs6EWMQP2RYBwjFLNT322Ji8TOC3IMPfsYCedNpzKfA==", + "license": "MIT", + "dependencies": { + "balanced-match": "^3.0.0" + }, + "engines": { + "node": ">= 18" + } + }, "node_modules/minimist": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", diff --git a/package.json b/package.json index 1ab46d0a45..d602a2613c 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "katex": "0.16.22", "mermaid": "11.6.0", "mini-css-extract-plugin": "2.9.2", - "minimatch": "10.0.1", + "minimatch": "10.0.2", "monaco-editor": "0.52.2", "monaco-editor-webpack-plugin": "7.1.0", "pdfobject": "2.3.0", diff --git a/routers/api/v1/repo/migrate.go b/routers/api/v1/repo/migrate.go index 4ee7aa58e4..a848a950db 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 63100bca06..3d6a40e9ab 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/services/migrations/gitlab.go b/services/migrations/gitlab.go index c4014c903f..f54f682c47 100644 --- a/services/migrations/gitlab.go +++ b/services/migrations/gitlab.go @@ -99,6 +99,7 @@ func NewGitlabDownloader(ctx context.Context, baseURL, repoPath, username, passw // Only use basic auth if token is blank and password is NOT // Basic auth will fail with empty strings, but empty token will allow anonymous public API usage if token == "" && password != "" { + //nolint // SA1019 gitlab.NewBasicAuthClient is deprecated: GitLab recommends against using this authentication method gitlabClient, err = gitlab.NewBasicAuthClient(username, password, gitlab.WithBaseURL(baseURL), gitlab.WithHTTPClient(NewMigrationHTTPClient())) } diff --git a/tests/e2e/declare_repos_test.go b/tests/e2e/declare_repos_test.go index 239a686f00..0ccb776ff7 100644 --- a/tests/e2e/declare_repos_test.go +++ b/tests/e2e/declare_repos_test.go @@ -54,7 +54,7 @@ func DeclareGitRepos(t *testing.T) func() { }, }), newRepo(t, 2, "file-uploads", []FileChanges{{ - Filename: "README.md", + Filename: "UPLOAD_TEST.md", Versions: []string{"# File upload test\nUse this repo to test various file upload features in new branches."}, }}), newRepo(t, 2, "unicode-escaping", []FileChanges{{ diff --git a/tests/integration/api_repo_test.go b/tests/integration/api_repo_test.go index 1c64cc642e..fd62670eb3 100644 --- a/tests/integration/api_repo_test.go +++ b/tests/integration/api_repo_test.go @@ -394,6 +394,7 @@ func TestAPIRepoMigrate(t *testing.T) { CloneAddr: testCase.cloneURL, RepoOwnerID: testCase.userID, RepoName: testCase.repoName, + Wiki: true, }).AddTokenAuth(token) resp := MakeRequest(t, req, NoExpectedStatus) require.Equalf(t, testCase.expectedStatus, resp.Code, "unexpected status (may be due to throttling): '%v' on url '%s'", resp.Body.String(), testCase.cloneURL)