]> source.dussan.org Git - gitea.git/log
gitea.git
2 years agoBump goldmark to v1.4.11 (#19201) (#19203)
Robert Kaussow [Thu, 24 Mar 2022 15:47:40 +0000 (16:47 +0100)]
Bump goldmark to v1.4.11 (#19201) (#19203)

* Bump goldmark to v1.4.11

* fix go.sum

Signed-off-by: Andrew Thornton <art27@cantab.net>
* add testcase

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
2 years agoChangelog for 1.16.5 (#19189) v1.16.5
zeripath [Thu, 24 Mar 2022 00:13:52 +0000 (00:13 +0000)]
Changelog for 1.16.5 (#19189)

* Changelog for 1.16.5

 ## [1.16.5](https://github.com/go-gitea/gitea/releases/tag/1.16.5) - 2022-03-23

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoFix showing issues in your repositories (#18916) (#19191)
6543 [Wed, 23 Mar 2022 23:36:38 +0000 (00:36 +0100)]
Fix showing issues in your repositories (#18916) (#19191)

- Make a restriction on which issues can be shown based on if you the user or team has write permission to the repository.
- Fixes a issue whereby you wouldn't see any associated issues with a specific team on a organization if you wasn't a member(fixed by zeroing the User{ID} in the options).
- Resolves #18913

Co-authored-by: Gusted <williamzijl7@hotmail.com>
2 years agoPrevent redirect to Host (2) (#19175) (#19186)
zeripath [Wed, 23 Mar 2022 20:01:23 +0000 (20:01 +0000)]
Prevent redirect to Host (2) (#19175) (#19186)

Backport #19175

Unhelpfully Locations starting with `/\` will be converted by the
browser to `//` because ... well I do not fully understand. Certainly
the RFCs and MDN do not indicate that this would be expected. Providing
"compatibility" with the (mis)behaviour of a certain proprietary OS is
my suspicion. However, we clearly have to protect against this.

Therefore we should reject redirection locations that match the regular
expression: `^/[\\\\/]+`

Reference #9678

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix compare link in active feeds for new branch (#19149) (#19185)
zeripath [Wed, 23 Mar 2022 19:04:50 +0000 (19:04 +0000)]
Fix compare link in active feeds for new branch (#19149) (#19185)

Backport #19149

When a new branch is pushed the old SHA is always listed as the empty sha and thus the compare link that is created does not work correctly.

Therefore when creating the compare link for new branches:

1. Attempt to get the parent of the first commit and use that as the basis
for the compare link.
2. If this is not possible make a comparison to the default branch
3. Finally if that is not possible simply do not show a compare link.

However, there are multiple broken compare links remaining therefore, in order for these to not break we will simply make the compare link redirect to the default branch.

Fix #19144

Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: a1012112796 <1012112796@qq.com>
2 years agoRedirect .wiki/* ui link to /wiki (#18831) (#19184)
zeripath [Wed, 23 Mar 2022 16:46:08 +0000 (16:46 +0000)]
Redirect .wiki/* ui link to /wiki (#18831) (#19184)

Backport #18831

Redirect .wiki/* ui link to /wiki

fix #18590

Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: a1012112796 <1012112796@qq.com>
2 years agoPrevent start panic due to missing DotEscape function
Andrew Thornton [Wed, 23 Mar 2022 16:08:27 +0000 (16:08 +0000)]
Prevent start panic due to missing DotEscape function

Unfortunately #19169 causing a panic at startup in prod mode. This was hidden by dev
mode because the templates are compiled dynamically there. The issue is that DotEscape
is not in the original FuncMap at the time of compilation which causes a panic.

Ref #19169

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix the bug: deploy key with write access can not push (#19010) (#19182)
zeripath [Wed, 23 Mar 2022 13:44:41 +0000 (13:44 +0000)]
Fix the bug: deploy key with write access can not push (#19010) (#19182)

Backport #19010

Use DeployKeyID to replace the IsDeployKey, then CanWriteCode uses the DeployKeyID to check the write permission.

Fix #19009

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoTry to prevent autolinking of displaynames by email readers (#19169) (#19183)
zeripath [Wed, 23 Mar 2022 13:18:11 +0000 (13:18 +0000)]
Try to prevent autolinking of displaynames by email readers (#19169) (#19183)

Backport #19169

Unfortunately many email readers will (helpfully) detect url or url-like names and
automatically create links to them, even in HTML emails. This is not ideal when
usernames can have dots in them.

This PR tries to prevent this behaviour by sticking ZWJ characters between dots and
also set the meta tag to prevent format detection.

Not every email template has been changed in this way - just the activation emails but
it may be that we should be setting the above meta tag in all of our emails too.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoClean paths when looking in Storage (#19124) (#19179)
zeripath [Wed, 23 Mar 2022 09:23:00 +0000 (09:23 +0000)]
Clean paths when looking in Storage (#19124) (#19179)

Backport #19124

* Clean paths when looking in Storage

Ensure paths are clean for minio aswell as local storage.

Use url.Path not RequestURI/EscapedPath in storageHandler.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Apply suggestions from code review

Co-authored-by: Lauris BH <lauris@nix.lv>
2 years agoCleanup protected branches when deleting users & teams (#19158) (#19174)
Norwin [Wed, 23 Mar 2022 05:56:53 +0000 (06:56 +0100)]
Cleanup protected branches when deleting users & teams (#19158) (#19174)

* Clean up protected_branches when deleting user

fixes #19094

* Clean up protected_branches when deleting teams

* fix issue

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoEnsure that setting.LocalURL always has a trailing slash (#19171) (#19177)
zeripath [Wed, 23 Mar 2022 04:56:52 +0000 (04:56 +0000)]
Ensure that setting.LocalURL always has a trailing slash (#19171) (#19177)

Backport #19171

Fix #19166

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoUse the new/choose link for New Issue on project page (#19172) (#19176)
zeripath [Wed, 23 Mar 2022 01:41:12 +0000 (01:41 +0000)]
Use the new/choose link for New Issue on project page (#19172) (#19176)

Backport #19172

Extend issues/new/choose to pass the project id and change New Issue
link on project page to use new/choose

Fix #19170

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoUse IterateBufferSize whilst querying repositories during adoption check (#19140...
zeripath [Tue, 22 Mar 2022 01:11:22 +0000 (01:11 +0000)]
Use IterateBufferSize whilst querying repositories during adoption check (#19140) (#19160)

Backport #19140

The adoption page checks directories to see if they are repositories by querying the
db on a per user basis. This can lead to problems if a user has a large number of
repositories or putative repositories.

This PR changes the buffering to check the db in IterataeBufferSize batches instead.

Fix #19137

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoEnsure isSSH is set whenever DISABLE_HTTP_GIT is set (#19028) (#19146)
zeripath [Mon, 21 Mar 2022 00:59:55 +0000 (00:59 +0000)]
Ensure isSSH is set whenever DISABLE_HTTP_GIT is set (#19028) (#19146)

Backport #19028

When DISABLE_HTTP_GIT is set we should always show the SSH button

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoUse custom favicon when viewing static files if it exists (#19130) (#19152)
Abheek Dhawan [Mon, 21 Mar 2022 00:28:35 +0000 (19:28 -0500)]
Use custom favicon when viewing static files if it exists (#19130) (#19152)

Redirect `/favicon.ico` to `/assets/img/favicon.png`.

Fix #19109

Co-authored-by: zeripath <art27@cantab.net>
2 years agoFix NPE /repos/issues/search when not signed in (#19154) (#19155)
Gusted [Sun, 20 Mar 2022 21:42:31 +0000 (21:42 +0000)]
Fix NPE /repos/issues/search when not signed in (#19154) (#19155)

- Backport #19154

  - Don't panic when on `/repos/issues/search?{created,assigned,mentioned,review_requested}=true` when client didn't pass any authentication.
  - Resolves #19115

2 years agoFix wrong scopes caused by empty scope input (#19029) (#19145)
zeripath [Sun, 20 Mar 2022 19:13:18 +0000 (19:13 +0000)]
Fix wrong scopes caused by empty scope input (#19029) (#19145)

Backport #19029
Fix #18972 Gitea prepends requested openid scope with + after updating authentication source

2 years agoFix the editor height in review box (#19003) (#19147)
zeripath [Sun, 20 Mar 2022 02:29:49 +0000 (02:29 +0000)]
Fix the editor height in review box (#19003) (#19147)

Backport #19003

Fix the height problem in  https://github.com/go-gitea/gitea/pull/18862#issuecomment-1059329539

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoDo not send notification emails to inactive users (#19131) (#19139)
zeripath [Sat, 19 Mar 2022 18:33:32 +0000 (18:33 +0000)]
Do not send notification emails to inactive users (#19131) (#19139)

Backport #19131
Backport #19142

Emails should not be sent to inactive users except for Activate and ResetPassword
messages.

Fix #18950

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoBump to build with go1.18 (#19120 et al) (#19127)
techknowlogick [Sat, 19 Mar 2022 17:46:47 +0000 (13:46 -0400)]
Bump to build with go1.18 (#19120 et al) (#19127)

Backport #19120
Backport #19099
Backport #18874
Backport #18420
Backport #19128
Backport #18270

Bump to build with go1.18

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Jelle Hulter <jellehulter@gmail.com>
2 years agoMake migrations SKIP_TLS_VERIFY apply to git too (#19132) (#19141)
zeripath [Sat, 19 Mar 2022 16:20:26 +0000 (16:20 +0000)]
Make migrations SKIP_TLS_VERIFY apply to git too (#19132) (#19141)

Backport #19132

Make SKIP_TLS_VERIFY apply to git data migrations too through adding the `-c http.sslVerify=false` option to the git clone command.

Fix #18998

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoDo not send activation email if manual confirm is set (#19119) (#19122)
zeripath [Sat, 19 Mar 2022 14:20:42 +0000 (14:20 +0000)]
Do not send activation email if manual confirm is set (#19119) (#19122)

Backport #19119

If the mailer is configured then even if Manual confirm is set an activation email
is still being sent because `handleUserCreated` is not checking for this case.

Fix #17263

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoUpdate golang.org/x/crypto (#19097) (#19098)
Gusted [Sat, 19 Mar 2022 12:16:15 +0000 (12:16 +0000)]
Update golang.org/x/crypto (#19097) (#19098)

Backport #19097

* Update golang.org/x/crypto (#19097)

- Backport #19097

* Fix deprecation notice

* Backport workaround removal

2 years agoHandle email address not exist (#19089) (#19121)
Lunny Xiao [Sat, 19 Mar 2022 11:35:23 +0000 (19:35 +0800)]
Handle email address not exist (#19089) (#19121)

Backport #19089

* Handle email address not exist. (#19089)

* Fix lint about strings.Title

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2 years agoUpdate json-iterator (#18644) (#19100)
Gusted [Tue, 15 Mar 2022 21:29:06 +0000 (21:29 +0000)]
Update json-iterator (#18644) (#19100)

- Backport #18644

2 years agoChangelog v1.16.4 (#19081) v1.16.4
6543 [Mon, 14 Mar 2022 20:55:33 +0000 (21:55 +0100)]
Changelog v1.16.4 (#19081)

2 years agoRestrict email address validation (#17688) (#19085)
6543 [Mon, 14 Mar 2022 19:51:58 +0000 (20:51 +0100)]
Restrict email address validation (#17688) (#19085)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoFix lfs bug (#19072) (#19080)
6543 [Mon, 14 Mar 2022 14:59:54 +0000 (15:59 +0100)]
Fix lfs bug (#19072) (#19080)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoRefactor mirror code & fix `StartToMirror` (#18904) (#19075)
Gusted [Mon, 14 Mar 2022 12:04:41 +0000 (12:04 +0000)]
Refactor mirror code & fix `StartToMirror` (#18904) (#19075)

- Backport #18904.

2 years agoUpdate the webauthn_credential_id_sequence in Postgres (#19048) (#19060)
zeripath [Sun, 13 Mar 2022 04:02:19 +0000 (04:02 +0000)]
Update the webauthn_credential_id_sequence in Postgres (#19048) (#19060)

Backport #19048

There is (yet) another problem with v210 in that Postgres will silently allow preset
ID insertions ... but it will not update the sequence value.

This PR simply adds a little step to the end of the v210 migration to update the
sequence number.

Users who have already migrated who find that they cannot insert new
webauthn_credentials into the DB can either run:

```bash
gitea doctor recreate-table webauthn_credential
```

or

```bash
SELECT setval('webauthn_credential_id_seq', COALESCE((SELECT MAX(id)+1 FROM `webauthn_credential`), 1), false)
```

which will fix the bad sequence.

Fix #19012

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoPrevent 500 when there is an error during new auth source post (#19041) (#19059)
zeripath [Sun, 13 Mar 2022 02:42:31 +0000 (02:42 +0000)]
Prevent 500 when there is an error during new auth source post (#19041) (#19059)

Backport #19041

Fix #19036

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoIf rendering has failed due to a net.OpError stop rendering (attempt 2) (#19049)...
zeripath [Thu, 10 Mar 2022 21:13:55 +0000 (21:13 +0000)]
If rendering has failed due to a net.OpError stop rendering (attempt 2) (#19049) (#19056)

Backport #19049

Unfortunately #18642 does not work because a `*net.OpError` does not implement
the `Is` interface to make `errors.Is` work correctly - thus leading to the
irritating conclusion that a `*net.OpError` is not a `*net.OpError`.

Here we keep the `errors.Is` because presumably this will be fixed at
some point in the golang main source code but also we add a simply type
cast to also check.

Fix #18629

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix flag validation (#19046) (#19051)
Norwin [Thu, 10 Mar 2022 20:23:55 +0000 (21:23 +0100)]
Fix flag validation (#19046) (#19051)

Regression from #5785

2 years agoImprove SyncMirrors logging (#19045) (#19050)
zeripath [Thu, 10 Mar 2022 15:06:35 +0000 (15:06 +0000)]
Improve SyncMirrors logging (#19045) (#19050)

Backport #19045

Yet another issue has come up where the logging from SyncMirrors does not provide
enough context. This PR adds more context to these logging events.

Related #19038

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agofix pam authorization (#19040) (#19047)
6543 [Thu, 10 Mar 2022 08:15:35 +0000 (09:15 +0100)]
fix pam authorization (#19040) (#19047)

Backport #19040

The PAM module has previously only checked the results of the authentication module.

However, in normal PAM practice most users will expect account module authorization to also be checked. Without doing this check in almost every configuration expired accounts and accounts with expired passwords will still be able to login.

This is likely to represent a significant gotcha in most configurations and cause most users configurations to be potentially insecure. Therefore we should add in the account authorization check.

## :warning: **BREAKING** :warning:

Users of the PAM module who rely on account modules not being checked will need to change their PAM configuration.

However, as it is likely that the vast majority of users of PAM will be expecting account authorization to be checked in addition to authentication we should make this breaking change to make the default behaviour correct for the majority.

---

I suggest we backport this despite the BREAKING nature because of the surprising nature of this.

Thanks to @ysf for bringing this to our attention.

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: ysf <34326+ysf@users.noreply.github.com>
2 years agoIgnore missing comment for user notifications (#18954) (#19043)
zeripath [Thu, 10 Mar 2022 06:48:27 +0000 (06:48 +0000)]
Ignore missing comment for user notifications (#18954) (#19043)

2 years agoSet `rel="nofollow noindex"` on new issue links (#19023) (#19042)
zeripath [Wed, 9 Mar 2022 23:01:30 +0000 (23:01 +0000)]
Set `rel="nofollow noindex"` on new issue links (#19023) (#19042)

Backport #19023

Fix #19018

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoUpgrading binding package (#19034) (#19035)
Lunny Xiao [Wed, 9 Mar 2022 18:07:46 +0000 (02:07 +0800)]
Upgrading binding package (#19034) (#19035)

Backport #19034

Fix #18855

2 years agoDon't show context cancelled errors in attribute reader (#19006) (#19027)
zeripath [Tue, 8 Mar 2022 11:20:37 +0000 (11:20 +0000)]
Don't show context cancelled errors in attribute reader (#19006) (#19027)

Backport #19006

Fix #18997

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoFix update hint bug (#19002)
Lunny Xiao [Fri, 4 Mar 2022 18:28:17 +0000 (02:28 +0800)]
Fix update hint bug (#19002)

2 years ago Fix potential assignee query for repo (#18994) (#18999)
Otto Richter (fnetX) [Fri, 4 Mar 2022 16:12:34 +0000 (17:12 +0100)]
 Fix potential assignee query for repo (#18994) (#18999)

* Fix potential assignee query for repo

* Add tests for `GetRepoAssignees`

- As per https://github.com/go-gitea/gitea/pull/18994#issuecomment-1058506640

Co-authored-by: Gusted <williamzijl7@hotmail.com>
2 years agoallow overwrite artifacts for github releases (#18987) (#18988)
6543 [Thu, 3 Mar 2022 15:18:55 +0000 (16:18 +0100)]
allow overwrite artifacts for github releases (#18987) (#18988)

2 years agoChangelog for v1.16.3 (#18966) v1.16.3
Lunny Xiao [Thu, 3 Mar 2022 02:50:36 +0000 (10:50 +0800)]
Changelog for v1.16.3 (#18966)

* Changelog for v1.16.3

* Update CHANGELOG.md

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
2 years agogit backend ignore replace objects (#18979) (#18980)
6543 [Wed, 2 Mar 2022 21:31:50 +0000 (22:31 +0100)]
git backend ignore replace objects (#18979) (#18980)

Co-authored-by: zeripath <art27@cantab.net>
2 years agoSet max text height to prevent overflow (#18862) (#18977)
Otto Richter (fnetX) [Wed, 2 Mar 2022 20:12:48 +0000 (21:12 +0100)]
Set max text height to prevent overflow (#18862) (#18977)

Sets a max height for review text boxes to prevent a very annoying bug where users cannot access the "submit" button.

Before:
![image](https://user-images.githubusercontent.com/12700993/155253001-e1dab086-aaf3-4338-889d-6a861728274a.png)

After:
![image](https://user-images.githubusercontent.com/12700993/155253144-5b9a3547-9582-412f-867f-41a45a14a0fe.png)

Interestingly, I don't see this bug on Firefox.

Co-authored-by: Kyle D <kdumontnu@gmail.com>
2 years agoFix problem when self-assign notification (#18797) (#18976)
Otto Richter (fnetX) [Wed, 2 Mar 2022 20:11:55 +0000 (21:11 +0100)]
Fix problem when self-assign notification (#18797) (#18976)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agobackport fix of #18973 (#18974)
6543 [Wed, 2 Mar 2022 19:42:02 +0000 (20:42 +0100)]
backport fix of #18973 (#18974)

2 years agoRefactor admin user filter query parameters (#18965) (#18975)
Otto Richter (fnetX) [Wed, 2 Mar 2022 18:57:18 +0000 (19:57 +0100)]
Refactor admin user filter query parameters (#18965) (#18975)

Only pass `status_filter` on admin page
Use a more general method to pass query parameters, remove hard-coded keys

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoAccounts with WebAuthn only (no TOTP) now exist ... fix code to handle that case...
6543 [Wed, 2 Mar 2022 13:22:02 +0000 (14:22 +0100)]
Accounts with WebAuthn only (no TOTP) now exist ... fix code to handle that case (#18897) (#18964)

2 years agoSend 404 on `/{org}.gpg` (#18959) (#18962)
Gusted [Wed, 2 Mar 2022 01:37:47 +0000 (01:37 +0000)]
Send 404 on `/{org}.gpg` (#18959) (#18962)

2 years agoFix admin user list pagination (#18957) (#18960)
Otto Richter (fnetX) [Tue, 1 Mar 2022 23:00:03 +0000 (00:00 +0100)]
Fix admin user list pagination (#18957) (#18960)

2 years agoFix lfs management setting (#18947)
Lunny Xiao [Tue, 1 Mar 2022 19:14:18 +0000 (03:14 +0800)]
Fix lfs management setting (#18947)

2 years agoBackport locales from master (#18944)
6543 [Mon, 28 Feb 2022 21:19:19 +0000 (22:19 +0100)]
Backport locales from master (#18944)

* update

* clean

* clean2

* clean2

* clean-next

* cleanup

* finish cleanup

2 years agoFix login with email panic when email is not exist (#18942)
Lunny Xiao [Mon, 28 Feb 2022 18:14:50 +0000 (02:14 +0800)]
Fix login with email panic when email is not exist (#18942)

Co-authored-by: 6543 <6543@obermui.de>
2 years agoAdjust error for already locked db and prevent level db lock on malformed connstr...
zeripath [Mon, 28 Feb 2022 15:45:38 +0000 (15:45 +0000)]
Adjust error for already locked db and prevent level db lock on malformed connstr (#18923) (#18938)

Backport #18923

This PR adjusts the error returned when there is failure to lock the level db, and
permits a connections to the same leveldb where there is a different connection string.

Reference #18921
Reference #18917

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoUpdate go-org to v1.6.1 (#18932) (#18933)
Gusted [Sun, 27 Feb 2022 16:57:06 +0000 (16:57 +0000)]
Update go-org to v1.6.1 (#18932) (#18933)

Backport #18932

2 years agoFix `<strong>` html in translation (#18929) (#18931)
Gusted [Sun, 27 Feb 2022 15:46:34 +0000 (15:46 +0000)]
Fix `<strong>` html in translation (#18929) (#18931)

Backport #18929

2 years ago Fix page and missing return on unadopted repos API (#18848) (#18927)
qwerty287 [Sun, 27 Feb 2022 12:18:23 +0000 (13:18 +0100)]
 Fix page and missing return on unadopted repos API (#18848) (#18927)

* Fix page and missing return on unadopted repos API

Page must be 1 if it's not specified and it should return after sending an internal server error.

* Allow ignore pages

2 years agoDon't treat BOM escape sequence as hidden character. (#18909) (#18910)
Gusted [Sat, 26 Feb 2022 22:15:04 +0000 (22:15 +0000)]
Don't treat BOM escape sequence as hidden character. (#18909) (#18910)

* Don't treat BOM escape sequence as hidden character. (#18909)

Backport #18909

2 years ago Allow adminstrator teams members to see other teams (#18918) (#18919)
Gusted [Sat, 26 Feb 2022 21:45:34 +0000 (21:45 +0000)]
 Allow adminstrator teams members to see other teams (#18918) (#18919)

Allow adminstrator teams members to see other teams (#18918)

2 years agoCorrectly link URLs to users/repos with dashes, dots or underscores (#18890) (#18908)
silverwind [Sat, 26 Feb 2022 05:45:09 +0000 (06:45 +0100)]
Correctly link URLs to users/repos with dashes, dots or underscores (#18890) (#18908)

* Add tests for references with dashes

This commit adds tests for full URLs referencing repos names and user
names containing a dash.

* Extend regex to match URLs to repos/users with dashes

Co-authored-by: Alexander Neumann <62751754+rtpt-alexanderneumann@users.noreply.github.com>
2 years agoDon't update email for organisation (#18905) (#18906)
Gusted [Sat, 26 Feb 2022 02:10:21 +0000 (02:10 +0000)]
Don't update email for organisation (#18905) (#18906)

Backport #18905

2 years agoFix redirect when using lowercase reponame (#18775) (#18902)
Otto Richter (fnetX) [Sat, 26 Feb 2022 00:16:22 +0000 (01:16 +0100)]
Fix redirect when using lowercase reponame (#18775) (#18902)

* Previously,  `GET {username}/{reponame}/raw///file-path` (the middle two slashes are blank to get the default branch) when the repo name has uppercase letters, e.g., https://try.gitea.io/AbdulrhmnGhanem/CH330_Hardware, using a lowercase version of the name redirected to the correct URL
* In other words both
   * `GET https://try.gitea.io/AbdulrhmnGhanem/CH330_Hardware/raw///images/back.png`
   * `GET https://try.gitea.io/AbdulrhmnGhanem/ch330_hardware/raw///images/back.png`
were redirecting to ` GET https://try.gitea.io/AbdulrhmnGhanem/CH330_Hardware/raw/branch/master/images/back.png`
This isn't the case after  #17551. Specifically because of this [line](https://github.com/zeripath/gitea/blob/cbd5eecd148dfca5fcb1a3da469e491a84f6b32b/modules/context/repo.go#L860).

Co-authored-by: Ghanem <37152329+AbdulrhmnGhanem@users.noreply.github.com>
2 years agoFix team management UI (#18887)
Lunny Xiao [Fri, 25 Feb 2022 20:51:22 +0000 (04:51 +0800)]
Fix team management UI (#18887)

2 years agoFix migration v210 (#18893)
Lunny Xiao [Fri, 25 Feb 2022 14:08:00 +0000 (22:08 +0800)]
Fix migration v210 (#18893)

2 years agoBeforeSourcePath should point to base commit (#18880)
Jimmy Praet [Fri, 25 Feb 2022 06:45:20 +0000 (07:45 +0100)]
BeforeSourcePath should point to base commit (#18880)

2 years agoAdd changelog for v1.16.2 (#18840) v1.16.2
Lunny Xiao [Thu, 24 Feb 2022 19:03:08 +0000 (03:03 +0800)]
Add changelog for v1.16.2 (#18840)

Add changelog for v1.16.2

Co-authored-by: 6543 <6543@obermui.de>
2 years agoFix ldap user sync missed email in email_address table (#18786) (#18876)
Lunny Xiao [Thu, 24 Feb 2022 18:07:52 +0000 (02:07 +0800)]
Fix ldap user sync missed email in email_address table (#18786) (#18876)

* Fix ldap user sync missed email in email_address table (#18786)

2 years agoDon't report signal: killed errors in serviceRPC (#18850) (#18865)
zeripath [Thu, 24 Feb 2022 08:59:50 +0000 (08:59 +0000)]
Don't report signal: killed errors in serviceRPC (#18850) (#18865)

Backport #18850

Fix #18849

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoUpdate assignees check to include any writing team and change org sidebar (#18680...
zeripath [Thu, 24 Feb 2022 01:22:46 +0000 (01:22 +0000)]
Update assignees check to include any writing team and change org sidebar (#18680) (#18873)

Backport #18680

Following the merging of #17811 teams can now have differing write and readonly permissions, however the assignee list will not include teams which have mixed perms.

Further the org sidebar is no longer helpful as it can't describe these mixed permissions situations.

Fix #18572

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix login with email for ldap users (#18800) (#18836)
Lunny Xiao [Tue, 22 Feb 2022 23:04:57 +0000 (07:04 +0800)]
Fix login with email for ldap users (#18800) (#18836)

`authenticator.Authenticate` has assume the login name is not an email, but `username` maybe an email. So when we find the user via email address, we should use `user.LoginName` instead of `username` which is an email address.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoFix ldap edit bug (#18859)
Lunny Xiao [Tue, 22 Feb 2022 22:31:29 +0000 (06:31 +0800)]
Fix ldap edit bug (#18859)

2 years agoFix ldap loginname (#18789) (#18804)
Lunny Xiao [Tue, 22 Feb 2022 13:33:06 +0000 (21:33 +0800)]
Fix ldap loginname (#18789) (#18804)

* Use email_address table to check user's email when login with email adress

* Update services/auth/signin.go

* Fix test

* Fix test

* Fix logging in with ldap username != loginname

* Fix if user does not exist yet

* Make more clear this is loginName

* Fix formatting

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Johan Van de Wauw <johan@gisky.be>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoIn disk_channel queues synchronously push to disk on shutdown (#18415) (#18788)
zeripath [Tue, 22 Feb 2022 12:08:35 +0000 (12:08 +0000)]
In disk_channel queues synchronously push to disk on shutdown (#18415) (#18788)

Partial Backport of #18415

Instead of using an asynchronous goroutine to push to disk on shutdown
just close the datachan and immediately push to the disk.

Prevents messages of incompletely flushed queues.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoFix bug for get user by email (#18834)
Lunny Xiao [Mon, 21 Feb 2022 18:34:22 +0000 (02:34 +0800)]
Fix bug for get user by email (#18834)

Backport #18833

Fix #18830

2 years agoUpdate go-org to 1.6.0 (#18824) (#18839)
zeripath [Mon, 21 Feb 2022 14:21:43 +0000 (14:21 +0000)]
Update go-org to 1.6.0 (#18824) (#18839)

Backport #18824

Fix #14074

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoShow fullname on issue edits and gpg/ssh signing info (#18828)
Wim [Sun, 20 Feb 2022 21:47:17 +0000 (22:47 +0100)]
Show fullname on issue edits and gpg/ssh signing info (#18828)

Co-authored-by: zeripath <art27@cantab.net>
2 years agoPut buttons back in org dashboard (#18817) (#18825)
Lunny Xiao [Sun, 20 Feb 2022 19:51:01 +0000 (03:51 +0800)]
Put buttons back in org dashboard (#18817) (#18825)

Backport #18817

Fix #18523

2 years agoImmediately Hammer if second kill is sent (#18823) (#18826)
zeripath [Sat, 19 Feb 2022 17:37:52 +0000 (17:37 +0000)]
Immediately Hammer if second kill is sent (#18823) (#18826)

Backport #18823

Currently Gitea will wait for HammerTime or nice shutdown if kill -1 or kill -2
is sent. We should just immediately hammer if there is a second kill.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix panic in EscapeReader (#18820) (#18821)
zeripath [Sat, 19 Feb 2022 15:34:32 +0000 (15:34 +0000)]
Fix panic in EscapeReader (#18820) (#18821)

Backport #18820

There is a potential panic due to a mistaken resetting of the length parameter when
multibyte characters go over a read boundary.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoremove redundant call to UpdateRepoStats during migration (#18591) (#18794)
singuliere [Thu, 17 Feb 2022 17:57:05 +0000 (18:57 +0100)]
remove redundant call to UpdateRepoStats during migration (#18591) (#18794)

There is no need to call UpdateRepoStats in the InsertIssues and
InsertPullRequests function. They are only called during migration by
the CreateIssues and CreateReviews methods of the gitea uploader.

The UpdateRepoStats function will be called by the Finish method of
the gitea uploader after all reviews and issues are inserted. Calling
it before is therefore redundant and the associated SQL requests are
not cheap.

The statistics tests done after inserting an issue or a pull request
are also removed. They predate the implementation of UpdateRepoStats,
back when the calculation of the statistics was an integral part of
the migration function. The UpdateRepoStats is now tested
independantly and these tests are no longer necessary.

Signed-off-by: singuliere <singuliere@autistici.org>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoAllow mermaid render error to wrap (#18791)
silverwind [Thu, 17 Feb 2022 07:42:29 +0000 (08:42 +0100)]
Allow mermaid render error to wrap (#18791)

2 years agoAttempt to fix the webauthn migration again - part 3 (#18770) (#18771)
zeripath [Wed, 16 Feb 2022 21:15:49 +0000 (21:15 +0000)]
Attempt to fix the webauthn migration again - part 3 (#18770) (#18771)

Backport #18770

v208.go is seriously broken as it misses an ID() check. We need to no-op and remigrate all of the u2f keys.

See #18756

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix template bug of LFS lock (#18784) (#18787)
Lunny Xiao [Wed, 16 Feb 2022 17:16:04 +0000 (01:16 +0800)]
Fix template bug of LFS lock (#18784) (#18787)

Backport #18784

Fix #18782

2 years agoVarious Mermaid improvements (#18776) (#18780)
silverwind [Wed, 16 Feb 2022 09:26:53 +0000 (10:26 +0100)]
Various Mermaid improvements (#18776) (#18780)

* Various Mermaid improvments

- Render into iframe for improved security
- Use built-in dark theme instead of color inversion
- Remove flexbox attributes, resulting in more consistent size rendering
- Update API usage and update to latest version

* restart ci

* misc tweaks

* remove unneccesary declaration

* make it work without allow-same-origin, add loading=lazy

* remove loading attribute, does not seem to work

* rename variable

* skip roundtrip to DOM for rendering

* don't guess chart height

* update comment to make it clear it's intentional

* tweak

* replace deprecated 'scrolling' property

* remove unused css file

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoEnsure git tag tests and others create test repos in tmpdir (#18447) (#18767)
zeripath [Tue, 15 Feb 2022 11:16:38 +0000 (11:16 +0000)]
Ensure git tag tests and others create test repos in tmpdir (#18447) (#18767)

Backport #18447

* Ensure git tag tests and other create test repos in tmpdir

There are a few places where tests appear to reuse testing repos which
causes random CI failures.

This PR simply changes these tests to ensure that cloning always happens
into new temporary directories.

Fix #18444

* Change log root for integration tests to use the REPO_TEST_DIR

There is a potential race in the drone integration tests whereby test-mysql etc
will start writing to log files causing make test-check fail.

Fix #18077

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoIncrease the size of the webauthn_credential credential_id field (#18739) (#18756)
zeripath [Mon, 14 Feb 2022 21:08:49 +0000 (21:08 +0000)]
Increase the size of the webauthn_credential credential_id field (#18739) (#18756)

* Increase the size of the webauthn_credential credential_id field (#18739)

Backport #18739

Unfortunately credentialIDs in u2f are 255 bytes long which with base32 encoding
becomes 408 bytes. The default size of a xorm string field is only a VARCHAR(255)

This problem is not apparent on SQLite because strings get mapped to TEXT there.

Fix #18727

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Ignore the migrate if u2f_registration is not exist (#18760)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoPrevent dangling GetAttribute calls (#18754) (#18755)
zeripath [Mon, 14 Feb 2022 20:27:55 +0000 (20:27 +0000)]
Prevent dangling GetAttribute calls (#18754) (#18755)

* Prevent dangling GetAttribute calls

It appears possible that there could be a hang due to unread data from the
repo-attribute command pipes. This PR simply closes these during the defer.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* move close into the defer

Signed-off-by: Andrew Thornton <art27@cantab.net>
* lets try again

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoSend mail to issue/pr assignee/reviewer also when OnMention is set (#18707) (#18765)
zeripath [Mon, 14 Feb 2022 13:13:41 +0000 (13:13 +0000)]
Send mail to issue/pr assignee/reviewer also when OnMention is set (#18707) (#18765)

Backport #18707

Addresses #17892, where emails notifications are not sent to assignees (issue and PR) and reviewers (PR) when they have the email setting Only email on mention enabled.

From the user experience perspective, when a user gets a issue/PR assigned or a PR review request, he/she would expect to be implicitly mentioned since the assignment or request is personal and targeting a single person only. Thus I see #17892 as a bug. Could we therefore mark this ticket as such?

The changed code just explicitly checks for the EmailNotificationsOnMention setting beside the existing EmailNotificationsEnabled check. Too rude?

@lunny mentioned a mock mail server for tests, is there something ready. How could I make use of it?

See #12774 (comment)

Fix #17892

Co-authored-by: flozzone <flozzone@gmail.com>
2 years agoFix a broken link in `commits_list_small.tmpl` (#18764)
wxiaoguang [Mon, 14 Feb 2022 12:03:51 +0000 (20:03 +0800)]
Fix a broken link in `commits_list_small.tmpl` (#18764)

2 years agoFix isempty detection of git repository (#18746) (#18750)
Lunny Xiao [Sun, 13 Feb 2022 16:33:35 +0000 (00:33 +0800)]
Fix isempty detection of git repository (#18746) (#18750)

* Fix isempty detection of git repository

* Fix IsEmpty check

2 years agoPrevent double encoding of branch names in delete branch (#18714) (#18738)
zeripath [Sat, 12 Feb 2022 15:17:45 +0000 (15:17 +0000)]
Prevent double encoding of branch names in delete branch (#18714) (#18738)

Backport #18714

* Prevent double encoding of branch names in delete branch

There is a double encoding issue in branch template whereby the branch name
ends up double encoded.

Fix #18709

Signed-off-by: Andrew Thornton <art27@cantab.net>
* and tag name

Signed-off-by: Andrew Thornton <art27@cantab.net>
* And fix #18704

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix forked repositories missed tags (#18719) (#18735)
Lunny Xiao [Sat, 12 Feb 2022 13:48:38 +0000 (21:48 +0800)]
Fix forked repositories missed tags (#18719) (#18735)

* Fix forked repositories missed tags

* Add missed close

* Use ctx

Co-authored-by: 6543 <6543@obermui.de>
2 years agoAlways set PullRequestWorkInProgressPrefixes in PrepareViewPullInfo (#18713) (#18737)
zeripath [Sat, 12 Feb 2022 12:55:34 +0000 (12:55 +0000)]
Always set PullRequestWorkInProgressPrefixes in PrepareViewPullInfo (#18713) (#18737)

Backport #18713

Move setting PullRequestWorkInProgressPrefixes to the start of PrepareViewPullInfo.

Fix #18706

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix source code line highlighting (#18729) (#18740)
Jimmy Praet [Sat, 12 Feb 2022 12:24:49 +0000 (13:24 +0100)]
Fix source code line highlighting (#18729) (#18740)

Backport #18729

When the issues repo unit is disabled, or an external issue tracker is used, there is no "a.ref-in-new-issue".

Fixes #18721
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoReduce CI go module downloads, add make targets (#18708, #18475, #18443) (#18741)
silverwind [Sat, 12 Feb 2022 10:43:08 +0000 (11:43 +0100)]
Reduce CI go module downloads, add make targets (#18708, #18475, #18443) (#18741)

Backport #18708
Backport #18475
Backport #18443

The CI currently downloads all go modules in each pipeline step because go modules reside outside the project directory. Fix this by introducing a volume for the `/go` directory [1] so modules are only downloaded once per pipeline using a new `deps-backend` make target.

For completeness, I also included new `deps` and `deps-frontend` targets and the frontend one is also triggered explicitly on CI where needed.

[1] https://docs.drone.io/pipeline/kubernetes/examples/language/golang/#dependencies

* Also backports #18475 and #18443 so that is was able to merge cleanly.
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoSeparate the details links of commit-statuses in headers (#18661) (#18730)
zeripath [Sat, 12 Feb 2022 03:40:55 +0000 (03:40 +0000)]
Separate the details links of commit-statuses in headers (#18661) (#18730)

Backport #18661

2 years agoFix release typo (#18728) (#18731)
Lunny Xiao [Sat, 12 Feb 2022 01:15:34 +0000 (09:15 +0800)]
Fix release typo (#18728) (#18731)

2 years agoUpdate object repo with the migrated repository (#18684) (#18726)
wxiaoguang [Fri, 11 Feb 2022 16:23:41 +0000 (00:23 +0800)]
Update object repo with the migrated repository (#18684) (#18726)

When migrating a repository (from GitHub) using the API (**POST** `repos/migrate`), the Code Indexer is not updated. Searching in the user interface will not return any results.

When migrating the same repository using **+/New Migration** in the web interface, the search index is updated and searching works as expected.

Caused by the fact that object `repo` is never updated with the migrated repo so `setting.Indexer.RepoIndexerEnabled && !repo.IsEmpty` in `modules/notification/indexer/indexer.go:NotifyMigrateRepository` always evaluates to `false`.

Tested with gitea:1.16.1, MariaDB:10, Breve in `Run Mode: Dev`.

Co-authored-by: Hugo Hoitink <10838836+hoitih@users.noreply.github.com>