Skip to content

Commit 1c00b23

Browse files
authored
Merge branch 'main' into nolintlint-flags
2 parents 80b05b7 + 750af1c commit 1c00b23

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+366
-419
lines changed

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ COMMA := ,
2626
XGO_VERSION := go-1.24.x
2727

2828
AIR_PACKAGE ?= github.com/air-verse/air@v1
29-
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3.2.1
30-
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.7.0
31-
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.2
29+
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3
30+
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.8.0
31+
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6
3232
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
33-
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.6.0
34-
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.31.0
33+
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.7.0
34+
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.32.3
3535
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
3636
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1
3737
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1
3838
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1
39-
GOPLS_PACKAGE ?= golang.org/x/tools/[email protected].0
40-
GOPLS_MODERNIZE_PACKAGE ?= golang.org/x/tools/gopls/internal/analysis/modernize/cmd/[email protected].0
39+
GOPLS_PACKAGE ?= golang.org/x/tools/[email protected].1
40+
GOPLS_MODERNIZE_PACKAGE ?= golang.org/x/tools/gopls/internal/analysis/modernize/cmd/[email protected].1
4141

4242
DOCKER_IMAGE ?= gitea/gitea
4343
DOCKER_TAG ?= latest

models/asymkey/gpg_key_add.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func AddGPGKey(ctx context.Context, ownerID int64, content, token, signature str
9191
signer, err = openpgp.CheckArmoredDetachedSignature(ekeys, strings.NewReader(token+"\r\n"), strings.NewReader(signature), nil)
9292
}
9393
if err != nil {
94-
log.Error("Unable to validate token signature. Error: %v", err)
94+
log.Debug("AddGPGKey CheckArmoredDetachedSignature failed: %v", err)
9595
return nil, ErrGPGInvalidTokenSignature{
9696
ID: ekeys[0].PrimaryKey.KeyIdString(),
9797
Wrapped: err,

models/asymkey/gpg_key_verify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func VerifyGPGKey(ctx context.Context, ownerID int64, keyID, token, signature st
8585
}
8686

8787
if signer == nil {
88-
log.Error("Unable to validate token signature. Error: %v", err)
88+
log.Debug("VerifyGPGKey failed: no signer")
8989
return "", ErrGPGInvalidTokenSignature{
9090
ID: key.KeyID,
9191
}

models/asymkey/ssh_key_verify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func VerifySSHKey(ctx context.Context, ownerID int64, fingerprint, token, signat
3535
// edge case for Windows based shells that will add CR LF if piped to ssh-keygen command
3636
// see https://github.com/PowerShell/PowerShell/issues/5974
3737
if sshsig.Verify(strings.NewReader(token+"\r\n"), []byte(signature), []byte(key.Content), "gitea") != nil {
38-
log.Error("Unable to validate token signature. Error: %v", err)
38+
log.Debug("VerifySSHKey sshsig.Verify failed: %v", err)
3939
return "", ErrSSHInvalidTokenSignature{
4040
Fingerprint: key.Fingerprint,
4141
}

modules/structs/hook.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ const (
286286
HookIssueReOpened HookIssueAction = "reopened"
287287
// HookIssueEdited edited
288288
HookIssueEdited HookIssueAction = "edited"
289+
// HookIssueDeleted is an issue action for deleting an issue
290+
HookIssueDeleted HookIssueAction = "deleted"
289291
// HookIssueAssigned assigned
290292
HookIssueAssigned HookIssueAction = "assigned"
291293
// HookIssueUnassigned unassigned

modules/structs/repo_file.go

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,23 @@ type FileOptions struct {
2222
Signoff bool `json:"signoff"`
2323
}
2424

25+
type FileOptionsWithSHA struct {
26+
FileOptions
27+
// the blob ID (SHA) for the file that already exists, it is required for changing existing files
28+
// required: true
29+
SHA string `json:"sha" binding:"Required"`
30+
}
31+
32+
func (f *FileOptions) GetFileOptions() *FileOptions {
33+
return f
34+
}
35+
36+
type FileOptionsInterface interface {
37+
GetFileOptions() *FileOptions
38+
}
39+
40+
var _ FileOptionsInterface = (*FileOptions)(nil)
41+
2542
// CreateFileOptions options for creating files
2643
// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
2744
type CreateFileOptions struct {
@@ -31,55 +48,38 @@ type CreateFileOptions struct {
3148
ContentBase64 string `json:"content"`
3249
}
3350

34-
// Branch returns branch name
35-
func (o *CreateFileOptions) Branch() string {
36-
return o.FileOptions.BranchName
37-
}
38-
3951
// DeleteFileOptions options for deleting files (used for other File structs below)
4052
// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
4153
type DeleteFileOptions struct {
42-
FileOptions
43-
// sha is the SHA for the file that already exists
44-
// required: true
45-
SHA string `json:"sha" binding:"Required"`
46-
}
47-
48-
// Branch returns branch name
49-
func (o *DeleteFileOptions) Branch() string {
50-
return o.FileOptions.BranchName
54+
FileOptionsWithSHA
5155
}
5256

5357
// UpdateFileOptions options for updating files
5458
// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
5559
type UpdateFileOptions struct {
56-
DeleteFileOptions
60+
FileOptionsWithSHA
5761
// content must be base64 encoded
5862
// required: true
5963
ContentBase64 string `json:"content"`
6064
// from_path (optional) is the path of the original file which will be moved/renamed to the path in the URL
6165
FromPath string `json:"from_path" binding:"MaxSize(500)"`
6266
}
6367

64-
// Branch returns branch name
65-
func (o *UpdateFileOptions) Branch() string {
66-
return o.FileOptions.BranchName
67-
}
68-
69-
// FIXME: ChangeFileOperation.SHA is NOT required for update or delete if last commit is provided in the options.
68+
// FIXME: there is no LastCommitID in FileOptions, actually it should be an alternative to the SHA in ChangeFileOperation
7069

7170
// ChangeFileOperation for creating, updating or deleting a file
7271
type ChangeFileOperation struct {
73-
// indicates what to do with the file
72+
// indicates what to do with the file: "create" for creating a new file, "update" for updating an existing file,
73+
// "upload" for creating or updating a file, "rename" for renaming a file, and "delete" for deleting an existing file.
7474
// required: true
75-
// enum: create,update,delete
75+
// enum: create,update,upload,rename,delete
7676
Operation string `json:"operation" binding:"Required"`
7777
// path to the existing or new file
7878
// required: true
7979
Path string `json:"path" binding:"Required;MaxSize(500)"`
80-
// new or updated file content, must be base64 encoded
80+
// new or updated file content, it must be base64 encoded
8181
ContentBase64 string `json:"content"`
82-
// sha is the SHA for the file that already exists, required for update or delete
82+
// the blob ID (SHA) for the file that already exists, required for changing existing files
8383
SHA string `json:"sha"`
8484
// old path of the file to move
8585
FromPath string `json:"from_path"`
@@ -94,20 +94,10 @@ type ChangeFilesOptions struct {
9494
Files []*ChangeFileOperation `json:"files" binding:"Required"`
9595
}
9696

97-
// Branch returns branch name
98-
func (o *ChangeFilesOptions) Branch() string {
99-
return o.FileOptions.BranchName
100-
}
101-
102-
// FileOptionInterface provides a unified interface for the different file options
103-
type FileOptionInterface interface {
104-
Branch() string
105-
}
106-
10797
// ApplyDiffPatchFileOptions options for applying a diff patch
10898
// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
10999
type ApplyDiffPatchFileOptions struct {
110-
DeleteFileOptions
100+
FileOptions
111101
// required: true
112102
Content string `json:"content"`
113103
}

options/locale/locale_cs-CZ.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,7 +2323,6 @@ settings.event_repository=Repozitář
23232323
settings.event_repository_desc=Repozitář vytvořen nebo smazán.
23242324
settings.event_header_issue=Události úkolů
23252325
settings.event_issues=Úkoly
2326-
settings.event_issues_desc=Úkol otevřen, uzavřen, znovu otevřen nebo upraven.
23272326
settings.event_issue_assign=Úkol přiřazen
23282327
settings.event_issue_assign_desc=Úkol přiřazen nebo nepřiřazen.
23292328
settings.event_issue_label=Úkol oštítkován
@@ -2334,7 +2333,6 @@ settings.event_issue_comment=Komentář k úkolu
23342333
settings.event_issue_comment_desc=Komentář úkolu přidán, upraven nebo smazán.
23352334
settings.event_header_pull_request=Události pull requestu
23362335
settings.event_pull_request=Pull request
2337-
settings.event_pull_request_desc=Pull request otevřen, uzavřen, znovu otevřen nebo upraven.
23382336
settings.event_pull_request_assign=Pull request přiřazen
23392337
settings.event_pull_request_assign_desc=Pull request přiřazen nebo nepřiřazen.
23402338
settings.event_pull_request_label=Pull request oštítkován

options/locale/locale_de-DE.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,7 +2367,6 @@ settings.event_repository=Repository
23672367
settings.event_repository_desc=Repository erstellt oder gelöscht.
23682368
settings.event_header_issue=Issue Ereignisse
23692369
settings.event_issues=Issues
2370-
settings.event_issues_desc=Issue geöffnet, geschlossen, wieder geöffnet oder bearbeitet.
23712370
settings.event_issue_assign=Issue zugewiesen
23722371
settings.event_issue_assign_desc=Issue zugewiesen oder Zuweisung entfernt.
23732372
settings.event_issue_label=Issue mit Label versehen
@@ -2378,7 +2377,6 @@ settings.event_issue_comment=Issue-Kommentar
23782377
settings.event_issue_comment_desc=Issue-Kommentar angelegt, geändert oder gelöscht.
23792378
settings.event_header_pull_request=Pull-Request-Ereignisse
23802379
settings.event_pull_request=Pull-Request
2381-
settings.event_pull_request_desc=Pull-Request geöffnet, geschlossen, wieder geöffnet oder bearbeitet.
23822380
settings.event_pull_request_assign=Pull-Request zugewiesen
23832381
settings.event_pull_request_assign_desc=Pull-Request zugewiesen oder Zuweisung entfernt.
23842382
settings.event_pull_request_label=Pull-Request mit Label versehen

options/locale/locale_el-GR.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2113,7 +2113,6 @@ settings.event_repository=Αποθετήριο
21132113
settings.event_repository_desc=Το αποθετήριο δημιουργήθηκε ή διαγράφηκε.
21142114
settings.event_header_issue=Γεγονότα Ζητήματος
21152115
settings.event_issues=Ζητήματα
2116-
settings.event_issues_desc=Το ζήτημα άνοιξε, έκλεισε, ανοίχθηκε εκ νέου ή επεξεργάστηκε.
21172116
settings.event_issue_assign=Ζήτημα Ανατέθηκε
21182117
settings.event_issue_assign_desc=Ζήτημα εκχωρημένο ή μη εκχωρημένο.
21192118
settings.event_issue_label=Σήμανση Ζητήματος
@@ -2124,7 +2123,6 @@ settings.event_issue_comment=Σχόλιο Ζητήματος
21242123
settings.event_issue_comment_desc=Το σχόλιο στο ζήτημα δημιουργήθηκε, επεξεργάστηκε ή διαγράφηκε.
21252124
settings.event_header_pull_request=Γεγονότα Pull Requests
21262125
settings.event_pull_request=Pull Request
2127-
settings.event_pull_request_desc=Το pull request άνοιξε, έκλεισε, άνοιξε εκ νέου ή επεξεργάστηκε.
21282126
settings.event_pull_request_assign=Το Pull Request Ανατέθηκε
21292127
settings.event_pull_request_assign_desc=Το pull request ανατέθηκε ή έγινε αδιάθετο.
21302128
settings.event_pull_request_label=Σήμανση Pull Request

options/locale/locale_en-US.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,7 +2384,7 @@ settings.event_repository = Repository
23842384
settings.event_repository_desc = Repository created or deleted.
23852385
settings.event_header_issue = Issue Events
23862386
settings.event_issues = Issues
2387-
settings.event_issues_desc = Issue opened, closed, reopened, or edited.
2387+
settings.event_issues_desc = Issue opened, closed, reopened, edited or deleted.
23882388
settings.event_issue_assign = Issue Assigned
23892389
settings.event_issue_assign_desc = Issue assigned or unassigned.
23902390
settings.event_issue_label = Issue Labeled
@@ -2395,7 +2395,7 @@ settings.event_issue_comment = Issue Comment
23952395
settings.event_issue_comment_desc = Issue comment created, edited, or deleted.
23962396
settings.event_header_pull_request = Pull Request Events
23972397
settings.event_pull_request = Pull Request
2398-
settings.event_pull_request_desc = Pull request opened, closed, reopened, or edited.
2398+
settings.event_pull_request_desc = Pull request opened, closed, reopened, edited or deleted.
23992399
settings.event_pull_request_assign = Pull Request Assigned
24002400
settings.event_pull_request_assign_desc = Pull request assigned or unassigned.
24012401
settings.event_pull_request_label = Pull Request Labeled

0 commit comments

Comments
 (0)