]> source.dussan.org Git - gitea.git/log
gitea.git
2 years agoFix repository adoption on Windows (#21646) (#21651)
zeripath [Tue, 1 Nov 2022 19:24:37 +0000 (19:24 +0000)]
Fix repository adoption on Windows (#21646) (#21651)

Backport #21646

A bug was introduced in #17865 where filepath.Join is used to join
putative unadopted repository owner and names together. This is
incorrect as these names are then used as repository names - which shoud
have the '/' separator. This means that adoption will not work on
Windows servers.

Fix #21632

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoSync git hooks when config file path changed (#21619) (#21625)
Jason Song [Sun, 30 Oct 2022 03:16:09 +0000 (11:16 +0800)]
Sync git hooks when config file path changed (#21619) (#21625)

Backport #21619 .

A patch to #17335.

Just like AppPath, Gitea writes its own CustomConf into git hook scripts
too. If Gitea's CustomConf changes, then the git push may fail.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoFix package access for admins and inactive users (#21580) (#21592)
KN4CK3R [Fri, 28 Oct 2022 01:38:59 +0000 (03:38 +0200)]
Fix package access for admins and inactive users (#21580) (#21592)

Backport of #21580

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoFix `Timestamp.IsZero` (#21593) (#21604)
KN4CK3R [Thu, 27 Oct 2022 08:47:47 +0000 (10:47 +0200)]
Fix `Timestamp.IsZero` (#21593) (#21604)

Backport of #21593

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoAdded check for disabled Packages (#21540) (#21614)
Xinyu Zhou [Thu, 27 Oct 2022 04:34:32 +0000 (12:34 +0800)]
Added check for disabled Packages (#21540) (#21614)

Backport #21540

At the moment, If admin disable Packages, still show the Packages on the
admin dashboard.

This patch added a check to hide the Packages entry.

2 years agoFix issues count bug (#21600)
Lunny Xiao [Wed, 26 Oct 2022 12:42:45 +0000 (20:42 +0800)]
Fix issues count bug (#21600)

backport #21557

2 years agoUpdate milestone counters when issue is deleted (#21459) (#21586)
Ashley Nelson [Wed, 26 Oct 2022 07:44:05 +0000 (02:44 -0500)]
Update milestone counters when issue is deleted (#21459) (#21586)

Backports #21459

When actions besides "delete" are performed on issues, the milestone
counter is updated. However, since deleting issues goes through a
different code path, the associated milestone's count wasn't being
updated, resulting in inaccurate counts until another issue in the same
milestone had a non-delete action performed on it.

I verified this change fixes the inaccurate counts using a local docker
build.

Co-authored-by: 6543 <6543@obermui.de>
2 years agoSuppress `ExternalLoginUserNotExist` error (#21504) (#21572)
KN4CK3R [Tue, 25 Oct 2022 16:08:05 +0000 (18:08 +0200)]
Suppress `ExternalLoginUserNotExist` error (#21504) (#21572)

Backport of #21504

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agosupport binary deploy in npm packages (#21589)
eleith [Tue, 25 Oct 2022 06:13:27 +0000 (23:13 -0700)]
support binary deploy in npm packages (#21589)

backport of #21372 for v1.17.4

-------------------

npm package.json supports binary packaging:
https://docs.npmjs.com/cli/v8/configuring-npm/package-json#bin

the npm registry documents that the binary references will be attached
to the abbreviated version object:

https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md#abbreviated-version-object

unfortunately their api documentation leaves this out:
https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md#abbreviated-version-objectdoc

which is likely to be the reason this was left out in gitea's initial
implementation

this response is critical for npm to install the binary in the .bin
folder so as to be included on the users default bin path, resulting in
immediate access to any binaries provided by the package

i have tested upload and installing through npm and can confirm the npm
registry now responds with bin in the version metadata and results in
the binary being available after install.

this fixes https://github.com/go-gitea/gitea/issues/21303

Co-authored-by: eleith <online-github@eleith.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoSessionUser protection against nil pointer dereference (#21581)
Paweł Bogusławski [Mon, 24 Oct 2022 19:05:35 +0000 (21:05 +0200)]
SessionUser protection against nil pointer dereference (#21581)

Backport #21358

`SessionUser` should be protected against passing `sess` = `nil` to
avoid

```
PANIC: runtime error: invalid memory address or nil pointer dereference
```

in

https://github.com/go-gitea/gitea/pull/18452/files#diff-a215b82aadeb8b4c4632fcf31215dd421f804eb1c0137ec6721b980136e4442aR69

after upgrade from gitea v1.16 to v1.17.

Related: https://github.com/go-gitea/gitea/pull/18452

2 years agoCase-insensitive NuGet symbol file GUID (#21409) (#21575)
Hubert Wawrzyńczyk [Mon, 24 Oct 2022 11:57:19 +0000 (13:57 +0200)]
Case-insensitive NuGet symbol file GUID (#21409) (#21575)

Backport of #21409

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoPrevent Authorization header for presigned LFS urls (#21531) (#21569)
KN4CK3R [Mon, 24 Oct 2022 03:18:31 +0000 (05:18 +0200)]
Prevent Authorization header for presigned LFS urls (#21531) (#21569)

Backport of #21531

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoUpdate binding to fix bugs (#21560)
Lunny Xiao [Mon, 24 Oct 2022 01:17:13 +0000 (09:17 +0800)]
Update binding to fix bugs (#21560)

backport #21556, Fix #19698

2 years agoCheck for valid user token in integration tests (#21520) (#21529)
silverwind [Sat, 22 Oct 2022 09:22:11 +0000 (11:22 +0200)]
Check for valid user token in integration tests (#21520) (#21529)

Backport #21520

Added checks for logged user token.

Some builds fail at unrelated tests, due to missing token.

Co-authored-by: Vladimir Yakovlev <nagos@inbox.ru>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoFix generating compare link (#21519) (#21530)
Lunny Xiao [Fri, 21 Oct 2022 12:59:27 +0000 (20:59 +0800)]
Fix generating compare link (#21519) (#21530)

Fix #6318, backport #21519

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoIgnore error when retrieving changed PR review files (#21487) (#21524)
delvh [Thu, 20 Oct 2022 15:25:54 +0000 (17:25 +0200)]
Ignore error when retrieving changed PR review files (#21487) (#21524)

When a PR reviewer reviewed a file on a commit that was later gc'ed,
they would always get a `500` response from then on when loading the PR.
This PR simply ignores that error and instead marks all files as
unchanged.
This approach was chosen as the only feasible option without diving into
**a lot** of error handling.

Fixes #21392
Backport of #21487

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoEnable Monaco automaticLayout (#21516)
silverwind [Wed, 19 Oct 2022 20:12:37 +0000 (22:12 +0200)]
Enable Monaco automaticLayout (#21516)

Enable
[`automaticLayout`](https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.IDiffEditorOptions.html#automaticLayout)
for monaco so it can reflow itself.

Fixes: https://github.com/go-gitea/gitea/issues/21508
2 years agoFix incorrect notification commit url (#21479) (#21483)
wxiaoguang [Tue, 18 Oct 2022 07:46:13 +0000 (15:46 +0800)]
Fix incorrect notification commit url (#21479) (#21483)

Backport #21479

For normal commits the notification url was wrong because oldCommitID is
received from the shrinked commits list.

This PR moves the commits list shrinking after the oldCommitID
assignment.

2 years agoDisplay total commit count in hook message (#21400) (#21481)
KN4CK3R [Mon, 17 Oct 2022 14:37:44 +0000 (16:37 +0200)]
Display total commit count in hook message (#21400) (#21481)

Backport of #21400

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoEnforce grouped NuGet search results (#21442) (#21480)
KN4CK3R [Mon, 17 Oct 2022 05:07:19 +0000 (07:07 +0200)]
Enforce grouped NuGet search results (#21442) (#21480)

Backport of #21442

2 years agoReturn 404 when user is not found on avatar (#21476) (#21477)
Gusted [Sun, 16 Oct 2022 16:56:58 +0000 (16:56 +0000)]
Return 404 when user is not found on avatar (#21476) (#21477)

- Backport #21476
- Instead of returning a 500 Internal Server when the user wasn't found,
return 404 Not found.

2 years agoChangelog v1.17.3 (#21456) v1.17.3
6543 [Sat, 15 Oct 2022 13:08:17 +0000 (15:08 +0200)]
Changelog v1.17.3 (#21456)

2 years agoimprove code quality (#21464) (#21463)
6543 [Sat, 15 Oct 2022 12:24:39 +0000 (14:24 +0200)]
improve code quality (#21464) (#21463)

Backport #21464 and #21465

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoDo DB update after merge in hammer context (#21401) (#21416)
zeripath [Wed, 12 Oct 2022 07:52:21 +0000 (08:52 +0100)]
Do DB update after merge in hammer context (#21401) (#21416)

Backport #21401

When merge was changed to run in the background context, the db updates
were still running in request context. This means that the merge could
be successful but the db not be updated.

This PR changes both these to run in the hammer context, this is not
complete rollback protection but it's much better.

Fix #21332

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoAdd Num{Issues,Pulls} stats checks (#21404) (#21414)
Gusted [Wed, 12 Oct 2022 06:47:48 +0000 (06:47 +0000)]
Add Num{Issues,Pulls} stats checks (#21404) (#21414)

Backport #21404

Currently `repository.Num{Issues,Pulls}` weren't checked and could
become out-of-consistency. Adds these two checks to `CheckRepoStats`.

Fix incorrect SQL query for `repository.NumClosedPulls`, the check
should be for `repo_num_pulls`.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoBump `golang.org/x/text` (#21412) (#21413)
Gusted [Tue, 11 Oct 2022 19:00:55 +0000 (19:00 +0000)]
Bump `golang.org/x/text` (#21412) (#21413)

- Backport #21412
- Update the `golang.org/x/text` dependency, this fixes [a security
issue](https://groups.google.com/g/golang-announce/c/-hjNw559_tE/m/KlGTfid5CAAJ).

2 years agoStop logging CheckPath returns error: context canceled (#21064) (#21405)
zeripath [Tue, 11 Oct 2022 08:35:29 +0000 (09:35 +0100)]
Stop logging CheckPath returns error: context canceled (#21064) (#21405)

Backport #21064

We should only log CheckPath errors if they are not simply due to
context cancellation - and we should add a little more context to the
error message.

Fix #20709

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoSet SemverCompatible to false for Conan packages (#21275) (#21366)
KN4CK3R [Mon, 10 Oct 2022 12:46:09 +0000 (14:46 +0200)]
Set SemverCompatible to false for Conan packages (#21275) (#21366)

Backport of #21275

2 years agoMake NuGet service index publicly accessible (#21242) (#21277)
KN4CK3R [Sat, 8 Oct 2022 15:23:41 +0000 (17:23 +0200)]
Make NuGet service index publicly accessible (#21242) (#21277)

Backport of #21242

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoParse OAuth Authorization header when request omits client secret (#21351) (#21374)
M Hickford [Sat, 8 Oct 2022 08:53:17 +0000 (09:53 +0100)]
Parse OAuth Authorization header when request omits client secret (#21351) (#21374)

Backport #21351

This fixes error "unauthorized_client: invalid client secret" when
client includes secret in Authorization header rather than request body.
OAuth spec permits both:
https://www.rfc-editor.org/rfc/rfc6749#section-2.3.1

Clients in possession of a client password MAY use the HTTP Basic
authentication scheme ... Alternatively, the authorization server MAY
support including the client credentials in the request-body

Sanity validation that client id and client secret in request are
consistent with Authorization header.

Improve error descriptions. Error codes remain the same.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoIgnore port for OAuth2 loopback redirect URIs (#21293) (#21373)
M Hickford [Sat, 8 Oct 2022 01:52:35 +0000 (02:52 +0100)]
Ignore port for OAuth2 loopback redirect URIs (#21293) (#21373)

Backport #21293

Following https://datatracker.ietf.org/doc/html/rfc8252#section-7.3

Fixes #21285

2 years agoTag list should include draft releases with existing tags (#21263) (#21365)
Jason Song [Fri, 7 Oct 2022 10:59:42 +0000 (18:59 +0800)]
Tag list should include draft releases with existing tags (#21263) (#21365)

Backport #21263.

Before, a tag for a draft release disappeared in the tag list, fix #21262.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoFix linked account translation (#21331) (#21334)
John Olheiser [Wed, 5 Oct 2022 14:25:34 +0000 (09:25 -0500)]
Fix linked account translation (#21331) (#21334)

2 years agoFix missing m.Run() in TestMain (#21341)
wxiaoguang [Wed, 5 Oct 2022 04:17:16 +0000 (12:17 +0800)]
Fix missing m.Run() in TestMain (#21341)

Backport #21340, add the missing m.Run()

2 years agoForeign ID conflicts if ID is 0 for each item (#21271) (#21272)
techknowlogick [Sun, 2 Oct 2022 21:43:30 +0000 (17:43 -0400)]
Foreign ID conflicts if ID is 0 for each item (#21271) (#21272)

The default is 0 if not defined, and that causes dupe index errors

Backport of #21271

2 years agoUpdate bluemonday (#21281) (#21287)
6543 [Wed, 28 Sep 2022 14:15:22 +0000 (16:15 +0200)]
Update bluemonday (#21281) (#21287)

Backport #21281

https://github.com/microcosm-cc/bluemonday/releases/tag/v1.0.20

Co-authored-by: Lauris BH <lauris@nix.lv>
2 years agoFix empty container layer history and UI (#21251) (#21278)
KN4CK3R [Tue, 27 Sep 2022 15:10:19 +0000 (17:10 +0200)]
Fix empty container layer history and UI (#21251) (#21278)

Backport of #21251

2 years agoUse absolute links in feeds (#21229) (#21265)
KN4CK3R [Mon, 26 Sep 2022 17:49:22 +0000 (19:49 +0200)]
Use absolute links in feeds (#21229) (#21265)

Backport of #21229

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years ago Use en-US as fallback when using other default language (#21200) (#21256)
wxiaoguang [Sun, 25 Sep 2022 14:14:57 +0000 (22:14 +0800)]
 Use en-US as fallback when using other default language (#21200) (#21256)

Only en-US has complete translations. When use other language as
default, the en-US should still be used as fallback.

Backport #21200, Close #21199

2 years ago Make Clone in VSCode link get updated correctly (#21225) (#21226)
wxiaoguang [Fri, 23 Sep 2022 04:10:26 +0000 (12:10 +0800)]
 Make Clone in VSCode link get updated correctly (#21225) (#21226)

Backport #21225, fix for #21128 (also in 1.17.3), close #21224

The indent was incorrect before, so this PR did some formatting work.

Bypass Golang's template bug for JS string interpolation. And since
there are JS lint rules for templates, so the string interpolation is
also a must.

2 years agoRespect `REQUIRE_SIGNIN_VIEW` for packages (#20873) (#21232)
KN4CK3R [Fri, 23 Sep 2022 03:25:53 +0000 (05:25 +0200)]
Respect `REQUIRE_SIGNIN_VIEW` for packages (#20873) (#21232)

Backport of #20873

When REQUIRE_SIGNIN_VIEW = true, even with public repositories, you can only see them after you login. The packages should not be accessed without login.

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoPrevent invalid behavior for file reviewing when loading more files (#21230) (#21234)
delvh [Fri, 23 Sep 2022 00:45:51 +0000 (02:45 +0200)]
Prevent invalid behavior for file reviewing when loading more files (#21230) (#21234)

Backport of #21230

The problem was that many PR review components loaded by `Show more`
received the same ID as previous batches, which confuses browsers (when
clicked). All such occurrences should now be fixed.

Additionally improved the background of the `viewed` checkbox.

Fixes #21228.
Fixes #20681.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoUse Go 1.19 fmt for Gitea 1.17, sync emoji data (#21239)
wxiaoguang [Thu, 22 Sep 2022 13:58:31 +0000 (21:58 +0800)]
Use Go 1.19 fmt for Gitea 1.17, sync emoji data (#21239)

The images used by Gitea's drone pipeline were upgraded to Go 1.19.x
It causes the lint fails because Go 1.19 uses new code format.

This PR partially backport #20758 (including the emoji-data sync),
partially fix the format manually.

2 years agoTreat git object mode 40755 as directory (#21195) (#21218)
wxiaoguang [Tue, 20 Sep 2022 16:40:23 +0000 (00:40 +0800)]
Treat git object mode 40755 as directory (#21195) (#21218)

Backport #21195

Git uses 040000 for tree object, but some users may get 040755 for
unknown reasons, fix #21190

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoMake the vscode clone link respect transport protocol (#20557) (#21128)
Abdul Monim [Tue, 20 Sep 2022 14:01:24 +0000 (20:01 +0600)]
Make the vscode clone link respect transport protocol (#20557) (#21128)

Backports #20557

Co-authored-by: Norwin <noerw@users.noreply.github.com>
Co-authored-by: Munim Munna <6266677+monim67@users.noreply.github.com>
2 years agoAllow uppercase ASCII alphabet in PyPI package names (#21095) (#21217)
KN4CK3R [Tue, 20 Sep 2022 09:37:24 +0000 (11:37 +0200)]
Allow uppercase ASCII alphabet in PyPI package names (#21095) (#21217)

Backport of #21095

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoFix limited user cannot view himself's profile (#21212)
Lunny Xiao [Tue, 20 Sep 2022 08:00:46 +0000 (16:00 +0800)]
Fix limited user cannot view himself's profile (#21212)

backport #21210, fix #21206

If user and viewer are equal the method should return true.
Also the common organization check was wrong as count can never be less then 0.

Tests are on main branch.

2 years agoFix template bug of admin monitor (#21209)
Lunny Xiao [Tue, 20 Sep 2022 00:15:08 +0000 (08:15 +0800)]
Fix template bug of admin monitor (#21209)

backport #21208

2 years agoFix reaction of issues (#21185) (#21196)
Jason Song [Sun, 18 Sep 2022 04:04:09 +0000 (12:04 +0800)]
Fix reaction of issues (#21185) (#21196)

Backport #21185.

Fix #20860.

`CommentID` in `FindReactionsOptions` should be -1 to search reactions
with zero comment id.

https://github.com/go-gitea/gitea/blob/8351172b6e5221290dc5b2c81e159e2eec0b43c8/models/issues/reaction.go#L108-L121

Co-authored-by: Lauris BH <lauris@nix.lv>
2 years agoFix CSV diff for added/deleted files (#21189) (#21193)
wxiaoguang [Sat, 17 Sep 2022 10:53:04 +0000 (18:53 +0800)]
Fix CSV diff for added/deleted files (#21189) (#21193)

Backport #21189
Fixes #21184
Regression of #19552

Instead of using `GetBlobByPath`, use the already existing instances.

2 years agoFix pagination limit parameter problem (#21111)
Tyrone Yeh [Thu, 8 Sep 2022 12:00:42 +0000 (20:00 +0800)]
Fix pagination limit parameter problem (#21111)

backport #21109

Co-authored-by: 6543 <6543@obermui.de>
2 years agoAdd MD5 back to template helper functions to avoid breaking (#21102)
wxiaoguang [Wed, 7 Sep 2022 11:30:52 +0000 (19:30 +0800)]
Add MD5 back to template helper functions to avoid breaking (#21102)

In #20932 the MD5 helper function was removed from template context,
it breaks user's customized templates.

This PR adds the MD5 helper function back.

2 years agoAdd changelog for v1.17.2 (#21089) v1.17.2
Lunny Xiao [Tue, 6 Sep 2022 21:32:20 +0000 (05:32 +0800)]
Add changelog for v1.17.2 (#21089)

Co-authored-by: John Olheiser <john+github@jolheiser.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoFix sub folder in repository missing add file dropdown (#21069) (#21083)
Tyrone Yeh [Tue, 6 Sep 2022 08:42:05 +0000 (16:42 +0800)]
Fix sub folder in repository missing add file dropdown (#21069) (#21083)

Backport #21069

In repository sub folder missing add file dropdown menu, Probably broken since #20602

2 years agoFix hard-coded timeout and error panic in API archive download endpoint (#20925)...
zeripath [Tue, 6 Sep 2022 06:54:47 +0000 (07:54 +0100)]
Fix hard-coded timeout and error panic in API archive download endpoint (#20925) (#21051)

Backport #20925

This commit updates the `GET /api/v1/repos/{owner}/{repo}/archive/{archive}`
endpoint which prior to this PR had a couple of issues.

1. The endpoint had a hard-coded 20s timeout for the archiver to complete after
   which a 500 (Internal Server Error) was returned to client. For a scripted
   API client there was no clear way of telling that the operation timed out and
   that it should retry.

2. Whenever the timeout _did occur_, the code used to panic. This was caused by
   the API endpoint "delegating" to the same call path as the web, which uses a
   slightly different way of reporting errors (HTML rather than JSON for
   example).

   More specifically, `api/v1/repo/file.go#GetArchive` just called through to
   `web/repo/repo.go#Download`, which expects the `Context` to have a `Render`
   field set, but which is `nil` for API calls. Hence, a `nil` pointer error.

The code addresses (1) by dropping the hard-coded timeout. Instead, any
timeout/cancelation on the incoming `Context` is used.

The code addresses (2) by updating the API endpoint to use a separate call path
for the API-triggered archive download. This avoids producing HTML-errors on
errors (it now produces JSON errors).

Signed-off-by: Peter Gardfjäll <peter.gardfjall.work@gmail.com>
Signed-off-by: Peter Gardfjäll <peter.gardfjall.work@gmail.com>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Peter Gardfjäll <peter.gardfjall.work@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoFix delete user missed some comments (#21067) (#21068)
Lunny Xiao [Mon, 5 Sep 2022 22:48:57 +0000 (06:48 +0800)]
Fix delete user missed some comments (#21067) (#21068)

2 years agoDelete unreferenced packages when deleting a package version (#20977) (#21060)
zeripath [Sun, 4 Sep 2022 16:17:48 +0000 (17:17 +0100)]
Delete unreferenced packages when deleting a package version (#20977) (#21060)

Backport #20977

Delete a package if its last version got deleted. Otherwise removing the owner works only after the clean up job ran.

Fix #20969

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2 years agoRedirect if user does not exist on admin pages (#20981) (#21059)
zeripath [Sun, 4 Sep 2022 16:17:35 +0000 (17:17 +0100)]
Redirect if user does not exist on admin pages (#20981) (#21059)

Backport #20981

When on /admin/users/ endpoints if the user is no longer in the DB,
redirect instead of causing a http 500.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2 years agoSet uploadpack.allowFilter etc on gitea serv to enable partial clones with ssh (...
zeripath [Sun, 4 Sep 2022 16:17:27 +0000 (17:17 +0100)]
Set uploadpack.allowFilter etc on gitea serv to enable partial clones with ssh (#20902) (#21058)

Backport #20902

When setting.Git.DisablePartialClone is set to false then the web server will add filter support to web http. It does this by using`-c` command arguments but this will not work on gitea serv as the upload-pack and receive-pack commands do not support this.

Instead we move these options into the .gitconfig instead.

Fix #20400

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix 500 on time in timeline API (#21052) (#21057)
qwerty287 [Sun, 4 Sep 2022 15:12:37 +0000 (17:12 +0200)]
Fix 500 on time in timeline API (#21052) (#21057)

Backport #21052

Before converting a TrackedTime for the API we need to load its attributes - otherwise we get an NPE.

Fix #21041

2 years agoFill the specified ref in webhook test payload (#20961) (#21055)
Jason Song [Sun, 4 Sep 2022 15:12:01 +0000 (23:12 +0800)]
Fill the specified ref in webhook test payload (#20961) (#21055)

Backport #20961

The webhook payload should use the right ref when it‘s specified in the testing request.

The compare URL should not be empty, a URL like `compare/A...A` seems useless in most cases but is helpful when testing.

2 years agoAdd another index for Action table on postgres (#21033) (#21054)
zeripath [Sun, 4 Sep 2022 15:11:02 +0000 (16:11 +0100)]
Add another index for Action table on postgres (#21033) (#21054)

Backport #21033

In #21031 we have discovered that on very big tables postgres will use a
search involving the sort term in preference to the restrictive index.

Therefore we add another index for postgres and update the original migration.

Fix #21031

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agofix broken insecureskipverify handling in rediss connection uris (#20967) (#21053)
zeripath [Sun, 4 Sep 2022 13:59:20 +0000 (14:59 +0100)]
fix broken insecureskipverify handling in rediss connection uris (#20967) (#21053)

Backport #20967

Currently, it's impossible to connect to self-signed TLS encrypted redis instances. The problem lies in inproper error handling, when building redis tls options - only invalid booleans are allowed to be used in `tlsConfig` builder. The problem is, when `strconv.ParseBool(...)` returns error, it always defaults to false - meaning it's impossible to set `tlsOptions.InsecureSkipVerify` to true.

Fixes #19213

Co-authored-by: Igor Rzegocki <ajgon@users.noreply.github.com>
2 years agoAdd more checks in migration code (#21011) (#21050)
zeripath [Sun, 4 Sep 2022 13:41:21 +0000 (14:41 +0100)]
Add more checks in migration code (#21011) (#21050)

Backport #21011

When migrating add several more important sanity checks:

* SHAs must be SHAs
* Refs must be valid Refs
* URLs must be reasonable

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoAdd Dev, Peer and Optional dependencies to npm PackageMetadataVersion (#21017) (...
José Carlos [Sat, 3 Sep 2022 19:11:03 +0000 (21:11 +0200)]
Add Dev, Peer and Optional dependencies to npm PackageMetadataVersion (#21017) (#21044)

Backport #21017

Set DevDependencies, PeerDependencies & OptionalDependencies in npm package metadatas

Fix https://github.com/go-gitea/gitea/issues/21013

2 years agoImprove arc-green code theme (#21039) (#21042)
silverwind [Sat, 3 Sep 2022 17:51:09 +0000 (19:51 +0200)]
Improve arc-green code theme (#21039) (#21042)

Backport #21039

- Increase contrasts overall
- Add various missing theme classes
- Ensure strings and constants are colored the same across languages

2 years agoAdd down key check has tribute container (#21016) (#21038)
Tyrone Yeh [Sat, 3 Sep 2022 13:36:27 +0000 (21:36 +0800)]
Add down key check has tribute container (#21016) (#21038)

Backport #21016

Fixes an issue where users would not be able to select by pressing the down arrow when using @TAG above a message

Bug videos:

https://user-images.githubusercontent.com/1255041/188095999-c4ccde18-e53b-4251-8a14-d90c4042d768.mp4

2 years agoDo not add links to Posters or Assignees with ID < 0 (#20577) (#21037)
zeripath [Sat, 3 Sep 2022 12:51:10 +0000 (13:51 +0100)]
Do not add links to Posters or Assignees with ID < 0 (#20577) (#21037)

Backport #20577

There are several places in templates/repo/issue/view_content/comments.tmpl where links are made to Posters or Assignees who are Ghosts or have IDs <0.

Fix #20559

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix modified due date message (#20388) (#21032)
Lucas Azevedo [Fri, 2 Sep 2022 19:18:34 +0000 (16:18 -0300)]
Fix modified due date message (#20388) (#21032)

Backport #20388

2 years agoFix missed sort bug (#21006)
Lunny Xiao [Wed, 31 Aug 2022 15:40:29 +0000 (23:40 +0800)]
Fix missed sort bug (#21006)

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2 years agoFix input.value attr for RequiredClaimName/Value (#20946) (#21001)
John Olheiser [Wed, 31 Aug 2022 14:57:03 +0000 (09:57 -0500)]
Fix input.value attr for RequiredClaimName/Value (#20946) (#21001)

Values set for RequiredClaimName and RequiredClaimValue do not show up on UI.
Fix typo `values` to `value`.

Co-authored-by: soumyadey <soumya.dey@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agofix: remove redundant if (#20997)
Jason Song [Tue, 30 Aug 2022 21:16:33 +0000 (05:16 +0800)]
fix: remove redundant if (#20997)

2 years agoTranslations for repo buttons (#20834)
John Olheiser [Mon, 29 Aug 2022 14:37:53 +0000 (09:37 -0500)]
Translations for repo buttons (#20834)

* Translations

Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Update locale_de-DE.ini

* Update locales

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoFix download archiver of a commit (#20962) (#20971)
Lunny Xiao [Sun, 28 Aug 2022 11:29:34 +0000 (19:29 +0800)]
Fix download archiver of a commit (#20962) (#20971)

2 years agoChange review buttons to icons to make space for text (#20934) (#20978)
silverwind [Sat, 27 Aug 2022 20:52:00 +0000 (22:52 +0200)]
Change review buttons to icons to make space for text (#20934) (#20978)

The layout on the review code view was broken depending on length of the text. Change all three buttons to icons with tooltip to make more space for these long texts.

Fixes: #20922
2 years agoEnable contenthash in filename for dynamic assets (#20813) (#20932)
silverwind [Thu, 25 Aug 2022 06:16:20 +0000 (08:16 +0200)]
Enable contenthash in filename for dynamic assets (#20813) (#20932)

This should solve the main problem of dynamic assets getting stale after
a version upgrade. Everything not affected will use query-string based
cache busting, which includes files loaded via HTML or worker scripts.

2 years agoReturn 404 NotFound if requested attachment does not exist (#20886) (#20941)
zeripath [Thu, 25 Aug 2022 03:30:41 +0000 (04:30 +0100)]
Return 404 NotFound if requested attachment does not exist (#20886) (#20941)

Backport #20886

Add code to test if GetAttachmentByID returns an ErrAttachmentNotExist error
and return NotFound instead of InternalServerError

Fix #20884

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoDisable doctor logging on panic (#20847) (#20898)
zeripath [Wed, 24 Aug 2022 14:04:41 +0000 (15:04 +0100)]
Disable doctor logging on panic (#20847) (#20898)

Backport #20847

If permissions are incorrect for writing to the doctor log simply disable the log file
instead of panicing.

Related #20570

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: delvh <dev.lh@web.de>
2 years agoSet no-tags in git fetch on compare (#20893) (#20936)
zeripath [Tue, 23 Aug 2022 20:42:55 +0000 (21:42 +0100)]
Set no-tags in git fetch on compare (#20893) (#20936)

Backport #20893

In the compare endpoint the git fetch is restricted to a certain branch however,
this does not completely prevent tag acquisition/pollution as git fetch will collect
any tags on that branch.

This causes pollution of the tag namespace and could cause confusion by users.

This PR adds `--no-tags` to the `git fetch` call.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoIn PushMirrorsIterate and MirrorsIterate if limit is negative do not set it (#20837...
zeripath [Tue, 23 Aug 2022 16:38:52 +0000 (17:38 +0100)]
In PushMirrorsIterate and MirrorsIterate if limit is negative do not set it (#20837) (#20899)

Backport #20837

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoFix mirror address setting not working (#20850) (#20904)
zeripath [Tue, 23 Aug 2022 14:14:02 +0000 (15:14 +0100)]
Fix mirror address setting not working (#20850) (#20904)

Backport #20850

This patch fixes the issue that the mirror address field is ignored from the repo setting form.

Co-authored-by: Gary Wang <wzc782970009@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoAllow multiple metadata files for Maven packages (#20674) (#20916)
KN4CK3R [Tue, 23 Aug 2022 02:00:58 +0000 (04:00 +0200)]
Allow multiple metadata files for Maven packages (#20674) (#20916)

* Allow file overwrite for meta files.

* Added tests.

* lint

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years ago Don't open new page for ext wiki on same repository (#20725) (#20910)
Gusted [Mon, 22 Aug 2022 23:58:11 +0000 (01:58 +0200)]
 Don't open new page for ext wiki on same repository (#20725) (#20910)

* Don't open new page for ext wiki on same repository (#20725)

- Backport of #20725
  - When the external wiki has been set to a file on the repository, don't open the page on a tab.
  - Resolves #20657

* Gofmt

* Fix line

Co-authored-by: zeripath <art27@cantab.net>
2 years agoPad GPG Key ID with preceding zeroes (#20878) (#20885)
zeripath [Mon, 22 Aug 2022 18:35:18 +0000 (19:35 +0100)]
Pad GPG Key ID with preceding zeroes (#20878) (#20885)

Backport #20878

The go crypto library does not pad keyIDs to 16 characters with preceding zeroes. This
is a somewhat confusing thing for most users who expect these to have preceding zeroes.

This PR prefixes any sub 16 length KeyID with preceding zeroes and removes preceding
zeroes from KeyIDs inputted on the API.

Fix #20876

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoIncrease Content field size of gpg_key and public_key to MEDIUMTEXT (#20896) (#20911)
zeripath [Mon, 22 Aug 2022 14:17:21 +0000 (15:17 +0100)]
Increase Content field size of gpg_key and public_key to MEDIUMTEXT (#20896) (#20911)

Backport #20896

Unfortunately some keys are too big to fix within the 65535 limit of TEXT on MySQL
this causes issues with these large keys.

Therefore increase these fields to MEDIUMTEXT.

Unfortunately the migration in #20896 cannot be backported to 1.17 so
affected users will have to use `gitea doctor recreate-table gpg_key public_key`

Fix #20894

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix push mirror address backend get error Address cause setting page display error...
zeripath [Mon, 22 Aug 2022 06:14:48 +0000 (07:14 +0100)]
Fix push mirror address backend get error Address cause setting page display error (#20593) (#20901)

2 years agoFix panic when an invalid oauth2 name is passed (#20820) (#20900)
zeripath [Mon, 22 Aug 2022 03:23:48 +0000 (04:23 +0100)]
Fix panic when an invalid oauth2 name is passed (#20820) (#20900)

2 years agoRemove calls to load Mirrors in user.Dashboard (#20855) (#20897)
zeripath [Mon, 22 Aug 2022 01:46:56 +0000 (02:46 +0100)]
Remove calls to load Mirrors in user.Dashboard (#20855) (#20897)

Backport #20855

Whilst looking at #20840 I noticed that the Mirrors data doesn't appear
to be being used therefore we can remove this and in fact none of the
related code is used elsewhere so it can also be removed.

Related #20840
Related #20804

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoFix SQL Query for `SearchTeam` (#20844) (#20872)
Gusted [Sun, 21 Aug 2022 18:31:51 +0000 (20:31 +0200)]
Fix SQL Query for `SearchTeam` (#20844) (#20872)

Backport #20844

Currently the function takes in the UserID option, but isn't being used within the SQL query. This patch fixes that by checking that only teams are being returned that the user belongs to.

Fix  #20829

2 years agoUpdate codemirror to 5.65.8 (#20875)
silverwind [Sun, 21 Aug 2022 16:25:46 +0000 (18:25 +0200)]
Update codemirror to 5.65.8 (#20875)

Includes fix for https://github.com/codemirror/codemirror5/issues/6893.

2 years agoDouble check CloneURL is acceptable (#20869) (#20892)
zeripath [Sun, 21 Aug 2022 14:42:48 +0000 (15:42 +0100)]
Double check CloneURL is acceptable (#20869) (#20892)

Backport #20869

Some Migration Downloaders provide re-writing of CloneURLs that may point to
unallowed urls. Recheck after the CloneURL is rewritten.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoEnsure that graceful start-up is informed of unused SSH listener (#20877)
JonRB [Sun, 21 Aug 2022 12:18:22 +0000 (13:18 +0100)]
Ensure that graceful start-up is informed of unused SSH listener (#20877)

The graceful manager waits for 4 listeners to be created or to be told that they are not needed. If it is not told about them it will indefinitely and timeout.

This leads to SVC hosts not being told of being in the readyState but on Unix would lead to the termination of the process.

There was an unfortunate regression in #20299 which missed this subtly and in the case whereby SSH is disabled the `builtinUnused()` is not called.

This PR adds a call to `builtinUnused()` when not using the builtin ssh to allow `createServerWaitGroup.Done()` to be called.

In addition it was noted that the if/else clauses for timeout informing of the SVC host were in the wrong order. These have been swapped.

Fix #20609

2 years agoRework repo buttons (#20602, #20718) (#20719)
silverwind [Sat, 20 Aug 2022 14:49:16 +0000 (16:49 +0200)]
Rework repo buttons (#20602, #20718) (#20719)

* Rework repo buttons (#20602)

* Rework repo buttons

- Replace "New PR" and "Go to File" button with Icon Button
- Move all "Add File" actions into a dropdown button
- Remove most custom styling of clone buttons
- Margin and wiki tweaks

Buttons are now all equal height, mobile layout wraps gracefully.

Fixes: https://github.com/go-gitea/gitea/issues/13671
Replaces: https://github.com/go-gitea/gitea/pull/20375

* Restore history button and hide add button when unable to add (#20718)

Fix two regressions from #20602:

- Restore the 'History' button that was previously unable to render
  because it's show condition was never hit
- Hide the 'Add File' button when there would be no items in the
  dropdown.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoFix the mode of custom dir to 0700 in docker-rootless (#20861) (#20867)
wxiaoguang [Sat, 20 Aug 2022 03:54:12 +0000 (11:54 +0800)]
Fix the mode of custom dir to 0700 in docker-rootless (#20861) (#20867)

2 years agoFix UI mis-align for PR commit history (#20845) (#20859)
wxiaoguang [Fri, 19 Aug 2022 08:54:33 +0000 (16:54 +0800)]
Fix UI mis-align for PR commit history (#20845) (#20859)

2 years agoupdate changelog v1.17.1
techknowlogick [Thu, 18 Aug 2022 19:34:24 +0000 (15:34 -0400)]
update changelog

2 years agoPrevent 500 is head repo does not have PullRequest unit in IsUserAllowedToUpdate...
zeripath [Thu, 18 Aug 2022 18:55:34 +0000 (19:55 +0100)]
Prevent 500 is head repo does not have PullRequest unit in IsUserAllowedToUpdate (#20839) (#20848)

Backport #20621

Some repositories do not have the PullRequest unit present in their configuration
and unfortunately the way that IsUserAllowedToUpdate currently works assumes
that this is an error instead of just returning false.

This PR simply swallows this error allowing the function to return false.

Fix #20621

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix owners cannot create organization repos bug (#20841) (#20854)
zeripath [Thu, 18 Aug 2022 18:54:48 +0000 (19:54 +0100)]
Fix owners cannot create organization repos bug (#20841) (#20854)

Backport #20841

* Fix owners cannot create organization repos bug

* Fix api

* Update routers/api/v1/org/team.go

Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2 years agoChangelog 1.17.1 (#20833)
zeripath [Thu, 18 Aug 2022 18:52:04 +0000 (19:52 +0100)]
Changelog 1.17.1 (#20833)

* Changelog 1.17.1

 ## [1.17.1](https://github.com/go-gitea/gitea/releases/tag/1.17.1) - 2022-08-17

* SECURITY
  * Correctly escape within tribute.js (#20831) (#20832)
* FEATURES
  * Add support for NuGet API keys (#20721) (#20734)
* ENHANCEMENTS
  * Display project in issue list (#20583)
  * Add disable download source configuration (#20548) (#20579)
* BUGFIXES
  * Use the total issue count for UI (#20785) (#20827)
  * Add proxy host into allow list (#20798) (#20819)
  * Add missing translation for queue flush workers (#20791) (#20792)
  * Improve comment header for mobile (#20781) (#20789)
  * Fix git.Init for doctor sub-command (#20782) (#20783)
  * Check webhooks slice length before calling xorm (#20642) (#20768)
  * Remove manual rollback for failed generated repositories (#20639) (#20762)
  * Use correct field name in npm template (#20675) (#20760)
  * Keep download count on Container tag overwrite (#20728) (#20735)
  * Fix v220 migration to be compatible for MSSQL 2008 r2 (#20702) (#20707)
  * Use request timeout for git service rpc (#20689) (#20693)
  * Send correct NuGet status codes (#20647) (#20677)
  * Use correct context to get package content (#20673) (#20676)
  * Fix the JS error "EventSource is not defined" caused by some non-standard browsers (#20584) (#20663)
  * Add default commit messages to PR for squash merge (#20618) (#20645)
  * Fix package upload for files >32mb (#20622) (#20635)
  * Fix the new-line copy-paste for rendered code (#20612)
  * Clean up and fix clone button script (#20415 & #20600) (#20599)
  *  Fix default merge style (#20564) (#20565)
  * Add repository condition for issue count (#20454) (#20496)
* MISC
  * Make branch icon stand out more (#20726) (#20774)
  * Fix loading button with invalid form (#20754) (#20759)
  * Add username check to doctor (#20140) (#20671)
  * Enable Wire 2 for Internal SSH Server (#20616) (#20617)
  *  Fix SecToTime edge-cases (#20610) (#20611)

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

Co-authored-by: John Olheiser <john+github@jolheiser.com>
* Update CHANGELOG.md

Co-authored-by: delvh <dev.lh@web.de>
* Update CHANGELOG.md

* Update CHANGELOG.md

* update changelog

* Update CHANGELOG.md

Co-authored-by: John Olheiser <john+github@jolheiser.com>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: John Olheiser <john+github@jolheiser.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoCheck Mirror exists before linking its Repo (#20840) (#20842)
Lunny Xiao [Thu, 18 Aug 2022 08:57:40 +0000 (16:57 +0800)]
Check Mirror exists before linking its Repo (#20840) (#20842)

In MirrorRepositoryList.loadAttributes there is some code to load the Mirror entries
from the database. This assumes that every Repository which has IsMirror set has
a Mirror associated in the DB. This association is incorrect in the case of
Mirror repository under creation when there is no Mirror entry in the DB until
completion.

Unfortunately LoadAttributes makes this incorrect assumption and presumes that a
Mirror will always be loaded. This then causes a panic.

This PR simply double checks if there a Mirror before attempting to link back to
its Repo. Unfortunately it should be expected that there may be other cases where
this incorrect assumption causes further problems.

Fix #20804

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>