]> source.dussan.org Git - gitea.git/log
gitea.git
22 months agoDo not allow Ghost access to limited visible user/org (#21849) (#21875)
KN4CK3R [Sun, 20 Nov 2022 12:35:26 +0000 (13:35 +0100)]
Do not allow Ghost access to limited visible user/org (#21849) (#21875)

Backport of #21849

Co-authored-by: Lauris BH <lauris@nix.lv>
22 months agoPrevent dangling user redirects (#21856) (#21859)
Gusted [Fri, 18 Nov 2022 14:24:49 +0000 (15:24 +0100)]
Prevent dangling user redirects (#21856) (#21859)

- Backport #21856
- It's possible that the `user_redirect` table contains a user id that
no longer exists.
  - Delete a user redirect upon deleting the user.
- Add a check for these dangling user redirects to check-db-consistency.

23 months agoFix enabling partial clones on 1.17 (#21809)
zeripath [Mon, 14 Nov 2022 07:58:11 +0000 (07:58 +0000)]
Fix enabling partial clones on 1.17 (#21809)

When backporting #20902 in #21058 there was a slight misbackport. It was
missed that we needed to remove the global command option before setting
the settings.

Fix #21805

Signed-off-by: Andrew Thornton <art27@cantab.net>
23 months agoPrevent panic in doctor command when running default checks (#21791) (#21808)
zeripath [Sun, 13 Nov 2022 22:43:40 +0000 (22:43 +0000)]
Prevent panic in doctor command when running default checks (#21791) (#21808)

Backport #21791

There was a bug introduced in #21352 due to a change of behaviour caused
by #19280. This causes a panic on running the default doctor checks
because the panic introduced by #19280 assumes that the only way
opts.StdOut and opts.Stderr can be set in RunOpts is deliberately.
Unfortunately, when running a git.Command the provided RunOpts can be
set, therefore if you share a common set of RunOpts these two values can
be set by the previous commands.

This PR stops using common RunOpts for the commands in that doctor check
but secondly stops RunCommand variants from changing the provided
RunOpts.

Signed-off-by: Andrew Thornton <art27@cantab.net>
23 months agoUpgrade golang.org/x/crypto (#21792) (#21794)
Gusted [Sun, 13 Nov 2022 04:43:43 +0000 (05:43 +0100)]
Upgrade golang.org/x/crypto (#21792) (#21794)

- Backport #21792
- Update the crypto dependency to include
https://github.com/golang/crypto/commit/6fad3dfc18918c2ac9c112e46b32473bd2e5e2f9
  - Resolves #17798

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
23 months agoLoad GitRepo in API before deleting issue (#21720) (#21795)
Jason Song [Sun, 13 Nov 2022 04:13:31 +0000 (12:13 +0800)]
Load GitRepo in API before deleting issue (#21720) (#21795)

Backport #21720.

Fix #20921.

The `ctx.Repo.GitRepo` has been used in deleting issues when the issue
is a PR.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
23 months agoIgnore line anchor links with leading zeroes (#21728) (#21777)
silverwind [Fri, 11 Nov 2022 16:45:40 +0000 (17:45 +0100)]
Ignore line anchor links with leading zeroes (#21728) (#21777)

23 months agoAdd HEAD fix to gitea doctor (#21352) (#21751)
Xinyu Zhou [Fri, 11 Nov 2022 06:38:52 +0000 (14:38 +0800)]
Add HEAD fix to gitea doctor (#21352) (#21751)

Backport #21352

Due to a bug in presumably an older version of Gitea, multiple of my
repositories still have their HEADs pointing to a `master` branch while
the default branch on the UI is listed as `main`. This adds a `gitea
doctor` command that will fix all of the HEAD references for repos when
they're not synchronized with the default branch in the DB.

This will help with cloning to ensure that git automatically checks out
the right branch, instead of a nonexistent one.

Note: I'm not sure if I actually need to do more other than add a file
here. Will try testing this out on my server soon.

Co-authored-by: Clar Fon <15850505+clarfonthey@users.noreply.github.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months ago Init git module before database migration (#21764) (#21766)
wxiaoguang [Thu, 10 Nov 2022 14:22:45 +0000 (22:22 +0800)]
 Init git module before database migration (#21764) (#21766)

Backport #21764

Some database migrations depend on the git module.

23 months agoSet last login when activating account (#21731) (#21754)
Jason Song [Thu, 10 Nov 2022 03:15:28 +0000 (11:15 +0800)]
Set last login when activating account (#21731) (#21754)

Backport #21731.

Fix #21698.

Set the last login time to the current time when activating the user
successfully.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoFix UI language switching bug (#21597) (#21748)
Xinyu Zhou [Thu, 10 Nov 2022 02:13:36 +0000 (10:13 +0800)]
Fix UI language switching bug (#21597) (#21748)

Backport #21597

Related:
* https://github.com/go-gitea/gitea/pull/21596#issuecomment-1291450224

There was a bug when switching language by AJAX: the irrelevant POST
requests were processed by the target page's handler.

Now, use GET instead of POST. The GET requests should be harmless.

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
23 months agoRemove semver compatible flag and change pypi to an array of test cases (#21708)...
Wayne Starr [Wed, 9 Nov 2022 15:02:21 +0000 (09:02 -0600)]
Remove semver compatible flag and change pypi to an array of test cases (#21708) (#21729)

Backport (#21708)

This addresses #21707 and adds a second package test case for a
non-semver compatible version (this might be overkill though since you
could also edit the old package version to have an epoch in front and
see the error, this just seemed more flexible for the future).

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
23 months agoAllow for resolution of NPM registry paths that match upstream (#21568) (#21723)
Wayne Starr [Wed, 9 Nov 2022 06:00:09 +0000 (00:00 -0600)]
Allow for resolution of NPM registry paths that match upstream (#21568) (#21723)

Backport (#21568)

This PR fixes issue #21567 allowing for package tarball URLs to match
the upstream registry (and GitLab/JFrog Artifactory URLs). It uses a
regex to parse the filename (which contains the NPM version) and does a
fuzzy search to pull it out. The regex was built/expanded from
http://json.schemastore.org/package,
https://github.com/Masterminds/semver, and
https://docs.npmjs.com/cli/v6/using-npm/semver and is testable here:
https://regex101.com/r/OydBJq/5

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoAllow local package identifiers for PyPI packages (#21690) (#21726)
Wayne Starr [Wed, 9 Nov 2022 01:10:25 +0000 (19:10 -0600)]
Allow local package identifiers for PyPI packages (#21690) (#21726)

Backport (#21690)

Fixes #21683

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
23 months 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>
23 months 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>
23 months 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>
23 months 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>
23 months 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.

23 months 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

23 months 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>
23 months 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>
23 months 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>
23 months 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

23 months 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>
23 months 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>
23 months 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

23 months 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>
23 months 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>
23 months 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>
23 months 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
23 months 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.

23 months 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)