Skip to content

Commit 912c7f1

Browse files
authored
Merge branch 'main' into lunny/fix_path_join
2 parents 74c7c90 + 82bc8b8 commit 912c7f1

Some content is hidden

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

43 files changed

+216
-147
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=

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.

modules/paginator/paginator_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ func TestPaginator(t *testing.T) {
7676
t.Run("Only current page", func(t *testing.T) {
7777
p := New(0, 10, 1, 1)
7878
pages := p.Pages()
79-
assert.Len(t, pages, 1)
80-
assert.Equal(t, 1, pages[0].Num())
81-
assert.True(t, pages[0].IsCurrent())
79+
assert.Empty(t, pages) // no "total", so no pages
8280

8381
p = New(1, 10, 1, 1)
8482
pages = p.Pages()

modules/setting/setting.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"time"
1313

1414
"code.gitea.io/gitea/modules/log"
15+
"code.gitea.io/gitea/modules/optional"
1516
"code.gitea.io/gitea/modules/user"
16-
"code.gitea.io/gitea/modules/util"
1717
)
1818

1919
// settings
@@ -159,7 +159,7 @@ func loadRunModeFrom(rootCfg ConfigProvider) {
159159
// The following is a purposefully undocumented option. Please do not run Gitea as root. It will only cause future headaches.
160160
// Please don't use root as a bandaid to "fix" something that is broken, instead the broken thing should instead be fixed properly.
161161
unsafeAllowRunAsRoot := ConfigSectionKeyBool(rootSec, "I_AM_BEING_UNSAFE_RUNNING_AS_ROOT")
162-
unsafeAllowRunAsRoot = unsafeAllowRunAsRoot || util.OptionalBoolParse(os.Getenv("GITEA_I_AM_BEING_UNSAFE_RUNNING_AS_ROOT")).Value()
162+
unsafeAllowRunAsRoot = unsafeAllowRunAsRoot || optional.ParseBool(os.Getenv("GITEA_I_AM_BEING_UNSAFE_RUNNING_AS_ROOT")).Value()
163163
RunMode = os.Getenv("GITEA_RUN_MODE")
164164
if RunMode == "" {
165165
RunMode = rootSec.Key("RUN_MODE").MustString("prod")

modules/util/util.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,10 @@ import (
1111
"strconv"
1212
"strings"
1313

14-
"code.gitea.io/gitea/modules/optional"
15-
1614
"golang.org/x/text/cases"
1715
"golang.org/x/text/language"
1816
)
1917

20-
// OptionalBoolParse get the corresponding optional.Option[bool] of a string using strconv.ParseBool
21-
func OptionalBoolParse(s string) optional.Option[bool] {
22-
v, e := strconv.ParseBool(s)
23-
if e != nil {
24-
return optional.None[bool]()
25-
}
26-
return optional.Some(v)
27-
}
28-
2918
// IsEmptyString checks if the provided string is empty
3019
func IsEmptyString(s string) bool {
3120
return len(strings.TrimSpace(s)) == 0

0 commit comments

Comments
 (0)