Skip to content

Commit 81ee6fb

Browse files
committed
Update to latest Gitea 1.16
2 parents 732d5e5 + ff1c581 commit 81ee6fb

File tree

21 files changed

+413
-186
lines changed

21 files changed

+413
-186
lines changed

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,35 @@ This changelog goes through all 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.io).
66

7+
## [1.16.3](https://github.com/go-gitea/gitea/releases/tag/v1.16.3) - 2022-03-02
8+
9+
* SECURITY
10+
* Git backend ignore replace objects (#18979) (#18980)
11+
* ENHANCEMENTS
12+
* Adjust error for already locked db and prevent level db lock on malformed connstr (#18923) (#18938)
13+
* BUGFIXES
14+
* Set max text height to prevent overflow (#18862) (#18977)
15+
* Fix newAttachmentPaths deletion for DeleteRepository() (#18973) (#18974)
16+
* Accounts with WebAuthn only (no TOTP) now exist ... fix code to handle that case (#18897) (#18964)
17+
* Send 404 on `/{org}.gpg` (#18959) (#18962)
18+
* Fix admin user list pagination (#18957) (#18960)
19+
* Fix lfs management setting (#18947) (#18946)
20+
* Fix login with email panic when email is not exist (#18942)
21+
* Update go-org to v1.6.1 (#18932) (#18933)
22+
* Fix `<strong>` html in translation (#18929) (#18931)
23+
* Fix page and missing return on unadopted repos API (#18848) (#18927)
24+
* Allow adminstrator teams members to see other teams (#18918) (#18919)
25+
* Don't treat BOM escape sequence as hidden character. (#18909) (#18910)
26+
* Correctly link URLs to users/repos with dashes, dots or underscores (… (#18908)
27+
* Fix redirect when using lowercase repo name (#18775) (#18902)
28+
* Fix migration v210 (#18893) (#18892)
29+
* Fix team management UI (#18887) (18886)
30+
* BeforeSourcePath should point to base commit (#18880) (#18799)
31+
* TRANSLATION
32+
* Backport locales from master (#18944)
33+
* MISC
34+
* Don't update email for organisation (#18905) (#18906)
35+
736
## [1.16.2](https://github.com/go-gitea/gitea/releases/tag/v1.16.2) - 2022-02-24
837

938
* ENHANCEMENTS

models/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ func DeleteRepository(doer *user_model.User, uid, repoID int64) error {
977977

978978
// Remove attachment with no issue_id and release_id.
979979
for i := range newAttachmentPaths {
980-
admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.Attachments, "Delete issue attachment", attachmentPaths[i])
980+
admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.Attachments, "Delete issue attachment", newAttachmentPaths[i])
981981
}
982982

983983
if len(repo.Avatar) > 0 {

models/user/list.go

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,19 @@ func (users UserList) GetTwoFaStatus() map[int64]bool {
3030
for _, user := range users {
3131
results[user.ID] = false // Set default to false
3232
}
33-
tokenMaps, err := users.loadTwoFactorStatus(db.GetEngine(db.DefaultContext))
34-
if err == nil {
33+
34+
if tokenMaps, err := users.loadTwoFactorStatus(db.GetEngine(db.DefaultContext)); err == nil {
3535
for _, token := range tokenMaps {
3636
results[token.UID] = true
3737
}
3838
}
3939

40+
if ids, err := users.userIDsWithWebAuthn(db.GetEngine(db.DefaultContext)); err == nil {
41+
for _, id := range ids {
42+
results[id] = true
43+
}
44+
}
45+
4046
return results
4147
}
4248

@@ -47,15 +53,23 @@ func (users UserList) loadTwoFactorStatus(e db.Engine) (map[int64]*auth.TwoFacto
4753

4854
userIDs := users.GetUserIDs()
4955
tokenMaps := make(map[int64]*auth.TwoFactor, len(userIDs))
50-
err := e.
51-
In("uid", userIDs).
52-
Find(&tokenMaps)
53-
if err != nil {
56+
if err := e.In("uid", userIDs).Find(&tokenMaps); err != nil {
5457
return nil, fmt.Errorf("find two factor: %v", err)
5558
}
5659
return tokenMaps, nil
5760
}
5861

62+
func (users UserList) userIDsWithWebAuthn(e db.Engine) ([]int64, error) {
63+
if len(users) == 0 {
64+
return nil, nil
65+
}
66+
ids := make([]int64, 0, len(users))
67+
if err := e.Table(new(auth.WebAuthnCredential)).In("user_id", users.GetUserIDs()).Select("user_id").Distinct("user_id").Find(&ids); err != nil {
68+
return nil, fmt.Errorf("find two factor: %v", err)
69+
}
70+
return ids, nil
71+
}
72+
5973
// GetUsersByIDs returns all resolved users from a list of Ids.
6074
func GetUsersByIDs(ids []int64) (UserList, error) {
6175
ous := make([]*User, 0, len(ids))

models/user/search.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
// SearchUserOptions contains the options for searching
2121
type SearchUserOptions struct {
2222
db.ListOptions
23+
2324
Keyword string
2425
Type UserType
2526
UID int64
@@ -34,6 +35,7 @@ type SearchUserOptions struct {
3435
IsTwoFactorEnabled util.OptionalBool
3536
IsProhibitLogin util.OptionalBool
3637

38+
ExtraParamStrings map[string]string
3739
// Codeberg-specific
3840
HideNoRepos util.OptionalBool
3941
}

modules/git/command.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ func (c *Command) RunWithContext(rc *RunContext) error {
163163
fmt.Sprintf("LC_ALL=%s", DefaultLocale),
164164
// avoid prompting for credentials interactively, supported since git v2.3
165165
"GIT_TERMINAL_PROMPT=0",
166+
// ignore replace references (https://git-scm.com/docs/git-replace)
167+
"GIT_NO_REPLACE_OBJECTS=1",
166168
)
167169

168170
// TODO: verify if this is still needed in golang 1.15

modules/nosql/manager_leveldb.go

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
package nosql
66

77
import (
8+
"fmt"
89
"path"
910
"strconv"
1011
"strings"
1112

13+
"code.gitea.io/gitea/modules/log"
1214
"github.com/syndtr/goleveldb/leveldb"
1315
"github.com/syndtr/goleveldb/leveldb/errors"
1416
"github.com/syndtr/goleveldb/leveldb/opt"
@@ -20,8 +22,16 @@ func (m *Manager) CloseLevelDB(connection string) error {
2022
defer m.mutex.Unlock()
2123
db, ok := m.LevelDBConnections[connection]
2224
if !ok {
23-
connection = ToLevelDBURI(connection).String()
24-
db, ok = m.LevelDBConnections[connection]
25+
// Try the full URI
26+
uri := ToLevelDBURI(connection)
27+
db, ok = m.LevelDBConnections[uri.String()]
28+
29+
if !ok {
30+
// Try the datadir directly
31+
dataDir := path.Join(uri.Host, uri.Path)
32+
33+
db, ok = m.LevelDBConnections[dataDir]
34+
}
2535
}
2636
if !ok {
2737
return nil
@@ -40,6 +50,12 @@ func (m *Manager) CloseLevelDB(connection string) error {
4050

4151
// GetLevelDB gets a levelDB for a particular connection
4252
func (m *Manager) GetLevelDB(connection string) (*leveldb.DB, error) {
53+
// Convert the provided connection description to the common format
54+
uri := ToLevelDBURI(connection)
55+
56+
// Get the datadir
57+
dataDir := path.Join(uri.Host, uri.Path)
58+
4359
m.mutex.Lock()
4460
defer m.mutex.Unlock()
4561
db, ok := m.LevelDBConnections[connection]
@@ -48,12 +64,28 @@ func (m *Manager) GetLevelDB(connection string) (*leveldb.DB, error) {
4864

4965
return db.db, nil
5066
}
51-
uri := ToLevelDBURI(connection)
67+
68+
db, ok = m.LevelDBConnections[uri.String()]
69+
if ok {
70+
db.count++
71+
72+
return db.db, nil
73+
}
74+
75+
// if there is already a connection to this leveldb reuse that
76+
// NOTE: if there differing options then only the first leveldb connection will be used
77+
db, ok = m.LevelDBConnections[dataDir]
78+
if ok {
79+
db.count++
80+
log.Warn("Duplicate connnection to level db: %s with different connection strings. Initial connection: %s. This connection: %s", dataDir, db.name[0], connection)
81+
db.name = append(db.name, connection)
82+
m.LevelDBConnections[connection] = db
83+
return db.db, nil
84+
}
5285
db = &levelDBHolder{
53-
name: []string{connection, uri.String()},
86+
name: []string{connection, uri.String(), dataDir},
5487
}
5588

56-
dataDir := path.Join(uri.Host, uri.Path)
5789
opts := &opt.Options{}
5890
for k, v := range uri.Query() {
5991
switch replacer.Replace(strings.ToLower(k)) {
@@ -134,7 +166,11 @@ func (m *Manager) GetLevelDB(connection string) (*leveldb.DB, error) {
134166
db.db, err = leveldb.OpenFile(dataDir, opts)
135167
if err != nil {
136168
if !errors.IsCorrupted(err) {
137-
return nil, err
169+
if strings.Contains(err.Error(), "resource temporarily unavailable") {
170+
return nil, fmt.Errorf("unable to lock level db at %s: %w", dataDir, err)
171+
}
172+
173+
return nil, fmt.Errorf("unable to open level db at %s: %w", dataDir, err)
138174
}
139175
db.db, err = leveldb.RecoverFile(dataDir, opts)
140176
if err != nil {

modules/notification/ui/ui.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func (ns *notificationService) NotifyPullRevieweDismiss(doer *user_model.User, r
204204
}
205205

206206
func (ns *notificationService) NotifyIssueChangeAssignee(doer *user_model.User, issue *models.Issue, assignee *user_model.User, removed bool, comment *models.Comment) {
207-
if !removed {
207+
if !removed && doer.ID != assignee.ID {
208208
var opts = issueNotificationOpts{
209209
IssueID: issue.ID,
210210
NotificationAuthorID: doer.ID,

options/locale/locale_de-DE.ini

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ webauthn_use_twofa=Zwei-Faktor-Authentifizierung via Handy verwenden
4141
webauthn_error=Dein Sicherheitsschlüssel konnte nicht gelesen werden.
4242
webauthn_unsupported_browser=Dein Browser unterstützt derzeit keinen WebAuthn.
4343
webauthn_error_unknown=Ein unbekannter Fehler ist aufgetreten. Bitte versuche es erneut.
44+
webauthn_error_insecure=WebAuthn unterstützt nur sichere Verbindungen. Zum Testen über HTTP kannst du "localhost" oder "127.0.0.1" als Host verwenden
4445
webauthn_error_unable_to_process=Der Server konnte deine Anfrage nicht bearbeiten.
4546
webauthn_error_duplicated=Für diese Anfrage ist der Sicherheitsschlüssel nicht erlaubt. Bitte stell sicher, dass er nicht bereits registriert ist.
4647
webauthn_error_timeout=Das Zeitlimit wurde erreicht, bevor dein Schlüssel gelesen werden konnte. Bitte lade die Seite erneut.
@@ -140,6 +141,7 @@ charset=Zeichensatz
140141
path=Pfad
141142
sqlite_helper=Dateipfad zur SQLite3 Datenbank.<br>Gebe einen absoluten Pfad an, wenn Gitea als Service gestartet wird.
142143
reinstall_error=Du versuchst, in eine bereits existierende Gitea Datenbank zu installieren
144+
reinstall_confirm_message=Eine Neuinstallation mit einer bestehenden Gitea-Datenbank kann mehrere Probleme verursachen. In den meisten Fällen solltest du deine vorhandene "app.ini" verwenden, um Gitea auszuführen. Wenn du weist, was du tust, bestätigen die folgenden Angaben:
143145
reinstall_confirm_check_3=Du bestätigst, dass du absolut sicher bist, dass diese Gitea mit der richtigen app.ini läuft, und du sicher bist, dass du neu installieren musst. Du bestätigst, dass du die oben genannten Risiken anerkennst.
144146
err_empty_db_path=Der SQLite3 Datenbankpfad darf nicht leer sein.
145147
no_admin_and_disable_registration=Du kannst Selbst-Registrierungen nicht deaktivieren, ohne ein Administratorkonto zu erstellen.
@@ -2050,8 +2052,8 @@ settings.lfs_pointers.accessible=Nutzer hat Zugriff
20502052
settings.lfs_pointers.associateAccessible=Ordne %d zugängliche OIDs zu
20512053
settings.rename_branch_failed_exist=Kann den Branch nicht umbenennen, da der Zielbranch %s bereits existiert.
20522054
settings.rename_branch_failed_not_exist=Kann den Branch %s nicht umbenennen, da er nicht existiert.
2053-
settings.rename_branch_success=Zweig %s wurde erfolgreich in %s umbenannt.
2054-
settings.rename_branch_from=alter Zweigname
2055+
settings.rename_branch_success=Branch %s wurde erfolgreich in %s umbenannt.
2056+
settings.rename_branch_from=alter Branchname
20552057
settings.rename_branch_to=neuer Branchname
20562058
settings.rename_branch=Branch umbennen
20572059

0 commit comments

Comments
 (0)