Skip to content

Commit 64b77b7

Browse files
authored
Merge branch 'main' into fix-git-mig
2 parents 51af079 + 536f4c6 commit 64b77b7

File tree

41 files changed

+230
-186
lines changed

Some content is hidden

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

41 files changed

+230
-186
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@ This changelog goes through the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.com).
66

7+
## [1.23.6](https://github.com/go-gitea/gitea/releases/tag/v1.23.6) - 2025-03-24
8+
9+
* SECURITY
10+
* Fix LFS URL (#33840) (#33843)
11+
* Update jwt and redis packages (#33984) (#33987)
12+
* Update golang crypto and net (#33989)
13+
* BUGFIXES
14+
* Drop timeout for requests made to the internal hook api (#33947) (#33970)
15+
* Fix maven panic when no package exists (#33888) (#33889)
16+
* Fix markdown render (#33870) (#33875)
17+
* Fix auto concurrency cancellation skips commit status updates (#33764) (#33849)
18+
* Fix oauth2 auth (#33961) (#33962)
19+
* Fix incorrect 1.23 translations (#33932)
20+
* Try to figure out attribute checker problem (#33901) (#33902)
21+
* Ignore trivial errors when updating push data (#33864) (#33887)
22+
* Fix some UI problems for 1.23 (#33856)
23+
* Removing unwanted ui container (#33833) (#33835)
24+
* Support disable passkey auth (#33348) (#33819)
25+
* Do not call "git diff" when listing PRs (#33817)
26+
* Try to fix ACME (3rd) (#33807) (#33808)
27+
* Fix incorrect code search indexer options (#33992) #33999
28+
729
## [1.23.5](https://github.com/go-gitea/gitea/releases/tag/v1.23.5) - 2025-03-04
830

931
* SECURITY

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ require (
6464
github.com/gobwas/glob v0.2.3
6565
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f
6666
github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85
67-
github.com/golang-jwt/jwt/v5 v5.2.1
67+
github.com/golang-jwt/jwt/v5 v5.2.2
6868
github.com/google/go-github/v61 v61.0.0
6969
github.com/google/licenseclassifier/v2 v2.0.0
7070
github.com/google/pprof v0.0.0-20250208200701-d0013a598941
@@ -99,7 +99,7 @@ require (
9999
github.com/pquerna/otp v1.4.0
100100
github.com/prometheus/client_golang v1.21.0
101101
github.com/quasoft/websspi v1.1.2
102-
github.com/redis/go-redis/v9 v9.7.0
102+
github.com/redis/go-redis/v9 v9.7.3
103103
github.com/robfig/cron/v3 v3.0.1
104104
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
105105
github.com/sassoftware/go-rpmutils v0.4.0
@@ -215,7 +215,7 @@ require (
215215
github.com/go-openapi/validate v0.24.0 // indirect
216216
github.com/go-webauthn/x v0.1.16 // indirect
217217
github.com/goccy/go-json v0.10.5 // indirect
218-
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
218+
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
219219
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
220220
github.com/golang-sql/sqlexp v0.1.0 // indirect
221221
github.com/golang/geo v0.0.0-20230421003525-6adc56603217 // indirect

go.sum

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,11 @@ github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f h1:3BSP1Tbs2djlpprl7w
374374
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f/go.mod h1:Pcatq5tYkCW2Q6yrR2VRHlbHpZ/R4/7qyL1TCF7vl14=
375375
github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85 h1:UjoPNDAQ5JPCjlxoJd6K8ALZqSDDhk2ymieAZOVaDg0=
376376
github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85/go.mod h1:fR6z1Ie6rtF7kl/vBYMfgD5/G5B1blui7z426/sj2DU=
377-
github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo=
378377
github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
379-
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
380-
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
378+
github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI=
379+
github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
380+
github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
381+
github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
381382
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA=
382383
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
383384
github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A=
@@ -655,8 +656,8 @@ github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoG
655656
github.com/quasoft/websspi v1.1.2 h1:/mA4w0LxWlE3novvsoEL6BBA1WnjJATbjkh1kFrTidw=
656657
github.com/quasoft/websspi v1.1.2/go.mod h1:HmVdl939dQ0WIXZhyik+ARdI03M6bQzaSEKcgpFmewk=
657658
github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
658-
github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E=
659-
github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw=
659+
github.com/redis/go-redis/v9 v9.7.3 h1:YpPyAayJV+XErNsatSElgRZZVCwXX9QzkKYNvO7x0wM=
660+
github.com/redis/go-redis/v9 v9.7.3/go.mod h1:bGUrSggJ9X9GUmZpZNEOQKaANxSGgOEBRltRTZHSvrA=
660661
github.com/redis/rueidis v1.0.19 h1:s65oWtotzlIFN8eMPhyYwxlwLR1lUdhza2KtWprKYSo=
661662
github.com/redis/rueidis v1.0.19/go.mod h1:8B+r5wdnjwK3lTFml5VtxjzGOQAC+5UmujoD12pDrEo=
662663
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=

models/repo/upload.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"io"
1111
"mime/multipart"
1212
"os"
13-
"path"
13+
"path/filepath"
1414

1515
"code.gitea.io/gitea/models/db"
1616
"code.gitea.io/gitea/modules/log"
@@ -53,7 +53,7 @@ func init() {
5353

5454
// UploadLocalPath returns where uploads is stored in local file system based on given UUID.
5555
func UploadLocalPath(uuid string) string {
56-
return path.Join(setting.Repository.Upload.TempPath, uuid[0:1], uuid[1:2], uuid)
56+
return filepath.Join(setting.Repository.Upload.TempPath, uuid[0:1], uuid[1:2], uuid)
5757
}
5858

5959
// LocalPath returns where uploads are temporarily stored in local file system.
@@ -69,7 +69,7 @@ func NewUpload(ctx context.Context, name string, buf []byte, file multipart.File
6969
}
7070

7171
localPath := upload.LocalPath()
72-
if err = os.MkdirAll(path.Dir(localPath), os.ModePerm); err != nil {
72+
if err = os.MkdirAll(filepath.Dir(localPath), os.ModePerm); err != nil {
7373
return nil, fmt.Errorf("MkdirAll: %w", err)
7474
}
7575

modules/git/hook.go

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ package git
77
import (
88
"errors"
99
"os"
10-
"path"
1110
"path/filepath"
1211
"strings"
1312

14-
"code.gitea.io/gitea/modules/log"
1513
"code.gitea.io/gitea/modules/util"
1614
)
1715

@@ -51,7 +49,7 @@ func GetHook(repoPath, name string) (*Hook, error) {
5149
}
5250
h := &Hook{
5351
name: name,
54-
path: path.Join(repoPath, "hooks", name+".d", name),
52+
path: filepath.Join(repoPath, "hooks", name+".d", name),
5553
}
5654
samplePath := filepath.Join(repoPath, "hooks", name+".sample")
5755
if isFile(h.path) {
@@ -103,7 +101,7 @@ func (h *Hook) Update() error {
103101

104102
// ListHooks returns a list of Git hooks of given repository.
105103
func ListHooks(repoPath string) (_ []*Hook, err error) {
106-
if !isDir(path.Join(repoPath, "hooks")) {
104+
if !isDir(filepath.Join(repoPath, "hooks")) {
107105
return nil, errors.New("hooks path does not exist")
108106
}
109107

@@ -116,28 +114,3 @@ func ListHooks(repoPath string) (_ []*Hook, err error) {
116114
}
117115
return hooks, nil
118116
}
119-
120-
const (
121-
// HookPathUpdate hook update path
122-
HookPathUpdate = "hooks/update"
123-
)
124-
125-
// SetUpdateHook writes given content to update hook of the repository.
126-
func SetUpdateHook(repoPath, content string) (err error) {
127-
log.Debug("Setting update hook: %s", repoPath)
128-
hookPath := path.Join(repoPath, HookPathUpdate)
129-
isExist, err := util.IsExist(hookPath)
130-
if err != nil {
131-
log.Debug("Unable to check if %s exists. Error: %v", hookPath, err)
132-
return err
133-
}
134-
if isExist {
135-
err = util.Remove(hookPath)
136-
} else {
137-
err = os.MkdirAll(path.Dir(hookPath), os.ModePerm)
138-
}
139-
if err != nil {
140-
return err
141-
}
142-
return os.WriteFile(hookPath, []byte(content), 0o777)
143-
}

modules/git/repo_commitgraph_gogit.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ package git
88

99
import (
1010
"os"
11-
"path"
11+
"path/filepath"
1212

1313
gitealog "code.gitea.io/gitea/modules/log"
1414

@@ -18,7 +18,7 @@ import (
1818

1919
// CommitNodeIndex returns the index for walking commit graph
2020
func (r *Repository) CommitNodeIndex() (cgobject.CommitNodeIndex, *os.File) {
21-
indexPath := path.Join(r.Path, "objects", "info", "commit-graph")
21+
indexPath := filepath.Join(r.Path, "objects", "info", "commit-graph")
2222

2323
file, err := os.Open(indexPath)
2424
if err == nil {

modules/indexer/code/bleve/bleve.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030
"github.com/blevesearch/bleve/v2"
3131
analyzer_custom "github.com/blevesearch/bleve/v2/analysis/analyzer/custom"
3232
analyzer_keyword "github.com/blevesearch/bleve/v2/analysis/analyzer/keyword"
33-
"github.com/blevesearch/bleve/v2/analysis/token/camelcase"
3433
"github.com/blevesearch/bleve/v2/analysis/token/lowercase"
3534
"github.com/blevesearch/bleve/v2/analysis/token/unicodenorm"
3635
"github.com/blevesearch/bleve/v2/analysis/tokenizer/letter"
@@ -72,7 +71,7 @@ const (
7271
filenameIndexerAnalyzer = "filenameIndexerAnalyzer"
7372
filenameIndexerTokenizer = "filenameIndexerTokenizer"
7473
repoIndexerDocType = "repoIndexerDocType"
75-
repoIndexerLatestVersion = 8
74+
repoIndexerLatestVersion = 9
7675
)
7776

7877
// generateBleveIndexMapping generates a bleve index mapping for the repo indexer
@@ -109,7 +108,7 @@ func generateBleveIndexMapping() (mapping.IndexMapping, error) {
109108
"type": analyzer_custom.Name,
110109
"char_filters": []string{},
111110
"tokenizer": letter.Name,
112-
"token_filters": []string{unicodeNormalizeName, camelcase.Name, lowercase.Name},
111+
"token_filters": []string{unicodeNormalizeName, lowercase.Name},
113112
}); err != nil {
114113
return nil, err
115114
}

modules/optional/option.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
package optional
55

6+
import "strconv"
7+
68
type Option[T any] []T
79

810
func None[T any]() Option[T] {
@@ -43,3 +45,12 @@ func (o Option[T]) ValueOrDefault(v T) T {
4345
}
4446
return v
4547
}
48+
49+
// ParseBool get the corresponding optional.Option[bool] of a string using strconv.ParseBool
50+
func ParseBool(s string) Option[bool] {
51+
v, e := strconv.ParseBool(s)
52+
if e != nil {
53+
return None[bool]()
54+
}
55+
return Some(v)
56+
}

modules/optional/option_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,16 @@ func TestOption(t *testing.T) {
5757
assert.True(t, opt3.Has())
5858
assert.Equal(t, int(1), opt3.Value())
5959
}
60+
61+
func Test_ParseBool(t *testing.T) {
62+
assert.Equal(t, optional.None[bool](), optional.ParseBool(""))
63+
assert.Equal(t, optional.None[bool](), optional.ParseBool("x"))
64+
65+
assert.Equal(t, optional.Some(false), optional.ParseBool("0"))
66+
assert.Equal(t, optional.Some(false), optional.ParseBool("f"))
67+
assert.Equal(t, optional.Some(false), optional.ParseBool("False"))
68+
69+
assert.Equal(t, optional.Some(true), optional.ParseBool("1"))
70+
assert.Equal(t, optional.Some(true), optional.ParseBool("t"))
71+
assert.Equal(t, optional.Some(true), optional.ParseBool("True"))
72+
}

modules/paginator/paginator.go

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
package paginator
66

7+
import "code.gitea.io/gitea/modules/util"
8+
79
/*
810
In template:
911
@@ -32,25 +34,43 @@ Output:
3234

3335
// Paginator represents a set of results of pagination calculations.
3436
type Paginator struct {
35-
total int // total rows count
37+
total int // total rows count, -1 means unknown
38+
totalPages int // total pages count, -1 means unknown
39+
current int // current page number
40+
curRows int // current page rows count
41+
3642
pagingNum int // how many rows in one page
37-
current int // current page number
3843
numPages int // how many pages to show on the UI
3944
}
4045

4146
// New initialize a new pagination calculation and returns a Paginator as result.
4247
func New(total, pagingNum, current, numPages int) *Paginator {
43-
if pagingNum <= 0 {
44-
pagingNum = 1
48+
pagingNum = max(pagingNum, 1)
49+
totalPages := util.Iif(total == -1, -1, (total+pagingNum-1)/pagingNum)
50+
if total >= 0 {
51+
current = min(current, totalPages)
4552
}
46-
if current <= 0 {
47-
current = 1
53+
current = max(current, 1)
54+
return &Paginator{
55+
total: total,
56+
totalPages: totalPages,
57+
current: current,
58+
pagingNum: pagingNum,
59+
numPages: numPages,
4860
}
49-
p := &Paginator{total, pagingNum, current, numPages}
50-
if p.current > p.TotalPages() {
51-
p.current = p.TotalPages()
61+
}
62+
63+
func (p *Paginator) SetCurRows(rows int) {
64+
// For "unlimited paging", we need to know the rows of current page to determine if there is a next page.
65+
// There is still an edge case: when curRows==pagingNum, then the "next page" will be an empty page.
66+
// Ideally we should query one more row to determine if there is really a next page, but it's impossible in current framework.
67+
p.curRows = rows
68+
if p.total == -1 && p.current == 1 && !p.HasNext() {
69+
// if there is only one page for the "unlimited paging", set total rows/pages count
70+
// then the tmpl could decide to hide the nav bar.
71+
p.total = rows
72+
p.totalPages = util.Iif(p.total == 0, 0, 1)
5273
}
53-
return p
5474
}
5575

5676
// IsFirst returns true if current page is the first page.
@@ -72,7 +92,10 @@ func (p *Paginator) Previous() int {
7292

7393
// HasNext returns true if there is a next page relative to current page.
7494
func (p *Paginator) HasNext() bool {
75-
return p.total > p.current*p.pagingNum
95+
if p.total == -1 {
96+
return p.curRows >= p.pagingNum
97+
}
98+
return p.current*p.pagingNum < p.total
7699
}
77100

78101
func (p *Paginator) Next() int {
@@ -84,10 +107,7 @@ func (p *Paginator) Next() int {
84107

85108
// IsLast returns true if current page is the last page.
86109
func (p *Paginator) IsLast() bool {
87-
if p.total == 0 {
88-
return true
89-
}
90-
return p.total > (p.current-1)*p.pagingNum && !p.HasNext()
110+
return !p.HasNext()
91111
}
92112

93113
// Total returns number of total rows.
@@ -97,10 +117,7 @@ func (p *Paginator) Total() int {
97117

98118
// TotalPages returns number of total pages.
99119
func (p *Paginator) TotalPages() int {
100-
if p.total == 0 {
101-
return 1
102-
}
103-
return (p.total + p.pagingNum - 1) / p.pagingNum
120+
return p.totalPages
104121
}
105122

106123
// Current returns current page number.
@@ -135,10 +152,10 @@ func getMiddleIdx(numPages int) int {
135152
// If value is -1 means "..." that more pages are not showing.
136153
func (p *Paginator) Pages() []*Page {
137154
if p.numPages == 0 {
138-
return []*Page{}
139-
} else if p.numPages == 1 && p.TotalPages() == 1 {
155+
return nil
156+
} else if p.total == -1 || (p.numPages == 1 && p.TotalPages() == 1) {
140157
// Only show current page.
141-
return []*Page{{1, true}}
158+
return []*Page{{p.current, true}}
142159
}
143160

144161
// Total page number is less or equal.

0 commit comments

Comments
 (0)