Skip to content

Commit 835165e

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Fix page and missing return on unadopted repos API (go-gitea#18848) [skip ci] Updated licenses and gitignores Allow adminstrator teams members to see other teams (go-gitea#18918) Update nginx reverse proxy docs (go-gitea#18922) Don't treat BOM escape sequence as hidden character. (go-gitea#18909) Remove CodeMirror dependencies (go-gitea#18911) Uncapitalize errors (go-gitea#18915) Disable service worker by default (go-gitea#18914) Set is_empty in fixtures (go-gitea#18869) Don't update email for organisation (go-gitea#18905) Correctly link URLs to users/repos with dashes, dots or underscores (go-gitea#18890) Set is_private in fixtures. (go-gitea#18868) Fix team management UI (go-gitea#18886) Update JS dependencies (go-gitea#18898) Fix migration v210 (go-gitea#18892) migrations: add test for importing pull requests in gitea uploader (go-gitea#18752)
2 parents c697b51 + 1563a45 commit 835165e

File tree

400 files changed

+1641
-62912
lines changed

Some content is hidden

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

400 files changed

+1641
-62912
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ rules:
442442
unicorn/require-post-message-target-origin: [0]
443443
unicorn/string-content: [0]
444444
unicorn/template-indent: [2]
445+
unicorn/text-encoding-identifier-case: [0]
445446
unicorn/throw-new-error: [2]
446447
use-isnan: [2]
447448
valid-typeof: [2, {requireStringLiterals: true}]

.stylelintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ rules:
1414
declaration-block-no-redundant-longhand-properties: null
1515
declaration-block-single-line-max-declarations: null
1616
declaration-empty-line-before: null
17+
function-no-unknown: null
1718
hue-degree-notation: null
1819
indentation: 2
1920
max-line-length: null

custom/conf/app.example.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ PATH =
11151115
;SEARCH_REPO_DESCRIPTION = true
11161116
;;
11171117
;; Whether to enable a Service Worker to cache frontend assets
1118-
;USE_SERVICE_WORKER = true
1118+
;USE_SERVICE_WORKER = false
11191119

11201120
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11211121
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
189189
add it to this config.
190190
- `DEFAULT_SHOW_FULL_NAME`: **false**: Whether the full name of the users should be shown where possible. If the full name isn't set, the username will be used.
191191
- `SEARCH_REPO_DESCRIPTION`: **true**: Whether to search within description at repository search on explore page.
192-
- `USE_SERVICE_WORKER`: **true**: Whether to enable a Service Worker to cache frontend assets.
192+
- `USE_SERVICE_WORKER`: **false**: Whether to enable a Service Worker to cache frontend assets.
193193

194194
### UI - Admin (`ui.admin`)
195195

docs/content/doc/developers/hacking-on-gitea.en-us.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ Before committing, make sure the linters pass:
185185
make lint-frontend
186186
```
187187

188-
Note: When working on frontend code, set `USE_SERVICE_WORKER` to `false` in `app.ini` to prevent undesirable caching of frontend assets.
189-
190188
### Configuring local ElasticSearch instance
191189

192190
Start local ElasticSearch instance using docker:

docs/content/doc/usage/reverse-proxies.en-us.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ server {
3030
3131
location / {
3232
proxy_pass http://localhost:3000;
33+
proxy_set_header Host $host;
34+
proxy_set_header X-Real-IP $remote_addr;
35+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
36+
proxy_set_header X-Forwarded-Proto $scheme;
3337
}
3438
}
3539
```
@@ -47,6 +51,10 @@ server {
4751
location /git/ {
4852
# Note: Trailing slash
4953
proxy_pass http://localhost:3000/;
54+
proxy_set_header Host $host;
55+
proxy_set_header X-Real-IP $remote_addr;
56+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
57+
proxy_set_header X-Forwarded-Proto $scheme;
5058
}
5159
}
5260
```

integrations/api_repo_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,6 @@ func TestAPIRepoTransfer(t *testing.T) {
468468
expectedStatus int
469469
}{
470470
// Disclaimer for test story: "user1" is an admin, "user2" is normal user and part of in owner team of org "user3"
471-
472471
// Transfer to a user with teams in another org should fail
473472
{ctxUserID: 1, newOwner: "user3", teams: &[]int64{5}, expectedStatus: http.StatusForbidden},
474473
// Transfer to a user with non-existent team IDs should fail
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ref: refs/heads/main
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[core]
2+
bare = true
3+
repositoryformatversion = 0
4+
filemode = false
5+
symlinks = false
6+
ignorecase = true

integrations/testlogger.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ func (log *TestLogger) Init(config string) error {
181181
return nil
182182
}
183183

184+
// Content returns the content accumulated in the content provider
185+
func (log *TestLogger) Content() (string, error) {
186+
return "", fmt.Errorf("not supported")
187+
}
188+
184189
// Flush when log should be flushed
185190
func (log *TestLogger) Flush() {
186191
}

models/fixtures/repository.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
owner_name: user2
2525
lower_name: repo2
2626
name: repo2
27+
is_empty: false
2728
is_archived: false
2829
is_private: true
2930
num_issues: 2
@@ -40,6 +41,7 @@
4041
owner_name: user3
4142
lower_name: repo3
4243
name: repo3
44+
is_empty: false
4345
is_private: true
4446
num_issues: 1
4547
num_closed_issues: 0
@@ -56,6 +58,7 @@
5658
owner_name: user5
5759
lower_name: repo4
5860
name: repo4
61+
is_empty: false
5962
is_private: false
6063
num_issues: 0
6164
num_closed_issues: 0
@@ -143,6 +146,7 @@
143146
owner_name: user12
144147
lower_name: repo10
145148
name: repo10
149+
is_empty: false
146150
is_private: false
147151
num_issues: 0
148152
num_closed_issues: 0
@@ -160,6 +164,7 @@
160164
owner_name: user13
161165
lower_name: repo11
162166
name: repo11
167+
is_empty: false
163168
is_private: false
164169
num_issues: 0
165170
num_closed_issues: 0
@@ -217,7 +222,8 @@
217222
owner_name: user2
218223
lower_name: repo15
219224
name: repo15
220-
is_empty: true
225+
is_empty: false
226+
is_private: true
221227
status: 0
222228

223229
-
@@ -226,6 +232,7 @@
226232
owner_name: user2
227233
lower_name: repo16
228234
name: repo16
235+
is_empty: false
229236
is_private: true
230237
num_issues: 0
231238
num_closed_issues: 0
@@ -459,6 +466,8 @@
459466
owner_name: user2
460467
lower_name: repo20
461468
name: repo20
469+
is_empty: false
470+
is_private: true
462471
num_stars: 0
463472
num_forks: 0
464473
num_issues: 0
@@ -484,6 +493,7 @@
484493
owner_name: user2
485494
lower_name: utf8
486495
name: utf8
496+
is_empty: false
487497
is_private: false
488498
status: 0
489499

@@ -519,6 +529,7 @@
519529
owner_name: user2
520530
lower_name: commits_search_test
521531
name: commits_search_test
532+
is_empty: false
522533
is_private: false
523534
num_stars: 0
524535
num_forks: 0
@@ -532,6 +543,7 @@
532543
owner_name: user2
533544
lower_name: git_hooks_test
534545
name: git_hooks_test
546+
is_empty: false
535547
is_private: false
536548
num_stars: 0
537549
num_forks: 0
@@ -545,6 +557,7 @@
545557
owner_name: limited_org
546558
lower_name: public_repo_on_limited_org
547559
name: public_repo_on_limited_org
560+
is_empty: false
548561
is_private: false
549562
num_stars: 0
550563
num_forks: 0
@@ -558,6 +571,7 @@
558571
owner_name: limited_org
559572
lower_name: private_repo_on_limited_org
560573
name: private_repo_on_limited_org
574+
is_empty: false
561575
is_private: true
562576
num_stars: 0
563577
num_forks: 0
@@ -571,6 +585,7 @@
571585
owner_name: privated_org
572586
lower_name: public_repo_on_private_org
573587
name: public_repo_on_private_org
588+
is_empty: false
574589
is_private: false
575590
num_stars: 0
576591
num_forks: 0
@@ -584,6 +599,7 @@
584599
owner_name: privated_org
585600
lower_name: private_repo_on_private_org
586601
name: private_repo_on_private_org
602+
is_empty: false
587603
is_private: true
588604
num_stars: 0
589605
num_forks: 0
@@ -596,6 +612,7 @@
596612
owner_name: user2
597613
lower_name: glob
598614
name: glob
615+
is_empty: false
599616
is_private: false
600617
num_stars: 0
601618
num_forks: 0
@@ -622,6 +639,7 @@
622639
owner_name: user27
623640
lower_name: template1
624641
name: template1
642+
is_empty: false
625643
is_private: false
626644
is_template: true
627645
num_stars: 0
@@ -650,6 +668,7 @@
650668
owner_name: org26
651669
lower_name: repo_external_tracker
652670
name: repo_external_tracker
671+
is_empty: false
653672
is_private: false
654673
num_stars: 0
655674
num_forks: 0
@@ -663,6 +682,7 @@
663682
owner_name: org26
664683
lower_name: repo_external_tracker_numeric
665684
name: repo_external_tracker_numeric
685+
is_empty: false
666686
is_private: false
667687
num_stars: 0
668688
num_forks: 0
@@ -676,6 +696,7 @@
676696
owner_name: org26
677697
lower_name: repo_external_tracker_alpha
678698
name: repo_external_tracker_alpha
699+
is_empty: false
679700
is_private: false
680701
num_stars: 0
681702
num_forks: 0
@@ -690,6 +711,7 @@
690711
owner_name: user27
691712
lower_name: repo49
692713
name: repo49
714+
is_empty: false
693715
is_private: false
694716
num_stars: 0
695717
num_forks: 0
@@ -736,3 +758,13 @@
736758
num_projects: 0
737759
num_closed_projects: 0
738760
status: 0
761+
762+
-
763+
id: 52
764+
owner_id: 30
765+
owner_name: user30
766+
lower_name: empty
767+
name: empty
768+
is_empty: true
769+
is_private: true
770+
status: 0

models/fixtures/user.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@
522522
is_restricted: true
523523
avatar: avatar29
524524
avatar_email: [email protected]
525-
num_repos: 2
525+
num_repos: 3
526526
is_active: true
527527
prohibit_login: true
528528

models/migrations/migrations.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ type Version struct {
6161
// update minDBVersion accordingly
6262
var migrations = []Migration{
6363
// Gitea 1.5.0 ends at v69
64-
6564
// v70 -> v71
6665
NewMigration("add issue_dependencies", addIssueDependencies),
6766
// v71 -> v72

models/migrations/testlogger_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ func (log *TestLogger) Init(config string) error {
166166
return nil
167167
}
168168

169+
// Content returns the content accumulated in the content provider
170+
func (log *TestLogger) Content() (string, error) {
171+
return "", fmt.Errorf("not supported")
172+
}
173+
169174
// Flush when log should be flushed
170175
func (log *TestLogger) Flush() {
171176
}

models/migrations/v210.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,23 @@ func remigrateU2FCredentials(x *xorm.Engine) error {
137137
CreatedUnix: reg.CreatedUnix,
138138
}
139139

140-
has, err := sess.ID(reg.ID).Where("id = ?", reg.ID).Get(new(webauthnCredential))
140+
has, err := sess.ID(reg.ID).Get(new(webauthnCredential))
141141
if err != nil {
142142
return fmt.Errorf("unable to get webauthn_credential[%d]. Error: %w", reg.ID, err)
143143
}
144144
if !has {
145-
_, err = sess.Insert(remigrated)
145+
has, err := sess.Where("`lower_name`=?", remigrated.LowerName).And("`user_id`=?", remigrated.UserID).Exist(new(webauthnCredential))
146146
if err != nil {
147-
return fmt.Errorf("unable to (re)insert webauthn_credential[%d]. Error: %w", reg.ID, err)
147+
return fmt.Errorf("unable to check webauthn_credential[lower_name: %s, user_id:%v]. Error: %w", remigrated.LowerName, remigrated.UserID, err)
148148
}
149+
if !has {
150+
_, err = sess.Insert(remigrated)
151+
if err != nil {
152+
return fmt.Errorf("unable to (re)insert webauthn_credential[%d]. Error: %w", reg.ID, err)
153+
}
149154

150-
continue
155+
continue
156+
}
151157
}
152158

153159
_, err = sess.ID(remigrated.ID).AllCols().Update(remigrated)

models/user/user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ func updateUser(ctx context.Context, u *User, changePrimaryEmail bool, cols ...s
861861
}); err != nil {
862862
return err
863863
}
864-
} else { // check if primary email in email_address table
864+
} else if !u.IsOrganization() { // check if primary email in email_address table
865865
primaryEmailExist, err := e.Where("uid=? AND is_primary=?", u.ID, true).Exist(&EmailAddress{})
866866
if err != nil {
867867
return err

modules/charset/escape.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func EscapeControlBytes(text []byte) (EscapeStatus, []byte) {
6363
func EscapeControlReader(text io.Reader, output io.Writer) (escaped EscapeStatus, err error) {
6464
buf := make([]byte, 4096)
6565
readStart := 0
66+
runeCount := 0
6667
var n int
6768
var writePos int
6869

@@ -79,6 +80,8 @@ readingloop:
7980

8081
for i < len(bs) {
8182
r, size := utf8.DecodeRune(bs[i:])
83+
runeCount++
84+
8285
// Now handle the codepoints
8386
switch {
8487
case r == utf8.RuneError:
@@ -113,6 +116,8 @@ readingloop:
113116
lineHasRTLScript = false
114117
lineHasLTRScript = false
115118

119+
case runeCount == 1 && r == 0xFEFF: // UTF BOM
120+
// the first BOM is safe
116121
case r == '\r' || r == '\t' || r == ' ':
117122
// These are acceptable control characters and space characters
118123
case unicode.IsSpace(r):

0 commit comments

Comments
 (0)