]> source.dussan.org Git - gitea.git/log
gitea.git
3 years agoChangelog for 1.14.6 (#16619) v1.14.6
zeripath [Thu, 5 Aug 2021 16:39:25 +0000 (17:39 +0100)]
Changelog for 1.14.6 (#16619)

## [1.14.6](https://github.com/go-gitea/gitea/releases/tag/v1.14.6) - 2021-08-04

* SECURITY
  * Bump github.com/markbates/goth from v1.67.1 to v1.68.0 (#16538) (#16540)
  * Switch to maintained JWT lib (#16532) (#16535)
  * Upgrade to latest version of golang-jwt (as forked for 1.14) (#16590) (#16607)
* BUGFIXES
  * Add basic edit ldap auth test & actually fix #16252 (#16465) (#16495)
  * Make cancel from CatFileBatch and CatFileBatchCheck wait for the command to end (#16479) (#16481)

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoUpgrade to latest version of golang-jwt (as forked for 1.14) (#16607)
zeripath [Tue, 3 Aug 2021 21:21:00 +0000 (22:21 +0100)]
Upgrade to latest version of golang-jwt (as forked for 1.14) (#16607)

* Forcibly update the vendored versions using a replace

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoupgraded github.com/markbates/goth v1.67.1 => v1.68.0 (#16540)
6543 [Sat, 24 Jul 2021 17:16:07 +0000 (19:16 +0200)]
upgraded github.com/markbates/goth v1.67.1 => v1.68.0 (#16540)

3 years agoswitch to maintained lib (#16535)
6543 [Sat, 24 Jul 2021 15:13:56 +0000 (17:13 +0200)]
switch to maintained lib (#16535)

Co-authored-by: Matti R <matti@mdranta.net>
3 years agoAdd basic edit ldap auth test & actually fix #16252 (#16465) (#16495)
zeripath [Thu, 22 Jul 2021 13:33:50 +0000 (14:33 +0100)]
Add basic edit ldap auth test & actually fix #16252 (#16465) (#16495)

Backport #16465

One of the reasons why #16447 was needed and why #16268 was needed in
the first place was because it appears that editing ldap configuration
doesn't get tested.

This PR therefore adds a basic test that will run the edit pipeline.

In doing so it's now clear that #16447 and #16268 aren't actually
solving #16252. It turns out that what actually happens is that is that
the bytes are actually double encoded.

This PR now changes the json unmarshal wrapper to handle this double
encode.

Fix #16252

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoMake cancel from CatFileBatch and CatFileBatchCheck wait for the command to end ...
zeripath [Wed, 21 Jul 2021 16:34:53 +0000 (17:34 +0100)]
Make cancel from CatFileBatch and CatFileBatchCheck wait for the command to end (#16479) (#16481)

* Make cancel from CatFileBatch and CatFileBatchCheck wait for the command to end

Fix #16427 (again!)

* handle sharing violation error code

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoRetry rename on lock induced failures (re-fix) (#16461) (#16463)
zeripath [Fri, 16 Jul 2021 16:48:39 +0000 (17:48 +0100)]
Retry rename on lock induced failures (re-fix) (#16461) (#16463)

Backport #16461

Unfortunately #16435 asserts the wrong error and should use
os.LinkError not os.PathError.

Fix #16439

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoChangelog for v1.14.5 (#16450) v1.14.5
zeripath [Fri, 16 Jul 2021 06:32:00 +0000 (07:32 +0100)]
Changelog for v1.14.5 (#16450)

Once #16449 is merged I think we should release 1.14.5. There are a couple of
security fixes and the broken #16268 is annoying enough that we should just release
things.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFix crash following ldap authentication update (#16447) (#16449)
zeripath [Fri, 16 Jul 2021 00:17:47 +0000 (01:17 +0100)]
Fix crash following ldap authentication update (#16447) (#16449)

Backport #16447

Unfortunately #16268 contained a terrible error, whereby there was a double
indirection taken when unmarshalling the source data. This fatally breaks
authentication configuration reading.

Fix #16342

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoRetry rename on lock induced failures (#16435) (#16439)
zeripath [Thu, 15 Jul 2021 19:57:51 +0000 (20:57 +0100)]
Retry rename on lock induced failures (#16435) (#16439)

Backport #16435

Due to external locking on Windows it is possible for an
os.Rename to fail if the files or directories are being
used elsewhere.

This PR simply suggests retrying the rename again similar
to how we handle the os.Remove problems.

Fix #16427

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years ago Validate issue index before querying DB (#16406) (#16410)
Norwin [Mon, 12 Jul 2021 20:22:47 +0000 (20:22 +0000)]
 Validate issue index before querying DB (#16406) (#16410)

3 years agoReplace `plugins/docker` with `techknowlogick/drone-docker`in ci (#16407) (#16409)
6543 [Mon, 12 Jul 2021 19:30:55 +0000 (21:30 +0200)]
Replace `plugins/docker` with `techknowlogick/drone-docker`in ci (#16407) (#16409)

* plugins/docker -> techknowlogick/drone-docker

* It is multi-arch

3 years agoUpdate bluemonday to v1.0.15 (#16379) (#16380)
6543 [Fri, 9 Jul 2021 00:47:27 +0000 (02:47 +0200)]
Update bluemonday to v1.0.15 (#16379) (#16380)

* Update bluemonday to v1.0.15 (#16379)

* Fix TESTS

3 years agoRedirect on bad CSRF instead of presenting bad page (#14937) (#16378)
6543 [Thu, 8 Jul 2021 18:12:20 +0000 (20:12 +0200)]
Redirect on bad CSRF instead of presenting bad page (#14937) (#16378)

The current CSRF handler is a bit harsh with bad CSRF tokens on webpages
I think we can be a little kinder and redirect to base page with a flash error

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoHide mirror passwords on repo settings page (#16022) (#16355)
Kyle D [Wed, 7 Jul 2021 14:22:32 +0000 (10:22 -0400)]
Hide mirror passwords on repo settings page (#16022) (#16355)

3 years agoChangelog for v1.14.4 (#16348) v1.14.4
Lunny Xiao [Tue, 6 Jul 2021 12:56:15 +0000 (20:56 +0800)]
Changelog for v1.14.4 (#16348)

3 years agoFix error message if user not exist (#16343)
6543 [Mon, 5 Jul 2021 20:58:47 +0000 (22:58 +0200)]
Fix error message if user not exist (#16343)

Co-authored-by: Sergey Dryabzhinsky <sergey@rusoft.ru>
3 years agoFix relative links in postprocessed images (#16334) (#16340)
zeripath [Sun, 4 Jul 2021 14:28:29 +0000 (15:28 +0100)]
Fix relative links in postprocessed images (#16334) (#16340)

* Fix relative links in postprocessed images (#16334)

If a pre-post-processed file contains relative img tags these need to be updated
and joined correctly with the prefix. Finally, the node attributes need to be updated.

Fix #16308

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoFix list_options GetStartEnd (#16303) (#16305)
6543 [Tue, 29 Jun 2021 23:23:24 +0000 (01:23 +0200)]
Fix list_options GetStartEnd (#16303) (#16305)

end is start + pageSize and not start + page

Co-authored-by: sebastian-sauer <sauer.sebastian@gmail.com>
3 years agoFix API to return author for author on commits(#16276) (#16277)
6543 [Mon, 28 Jun 2021 01:37:42 +0000 (03:37 +0200)]
Fix API to return author for author on commits(#16276) (#16277)

3 years agoHandle misencoding of login_source cfg in mssql (#16268) (#16275)
zeripath [Sun, 27 Jun 2021 21:33:25 +0000 (22:33 +0100)]
Handle misencoding of login_source cfg in mssql (#16268) (#16275)

Backport #16268

Unfortunately due a bug in xorm (see https://gitea.com/xorm/xorm/pulls/1957) updating
loginsources on MSSQL causes them to become corrupted. (#16252)

Whilst waiting for the referenced PR to be merged and to handle the corrupted
loginsources correctly we need to add a wrapper to the `FromDB()` methods to look
for and ignore the misplaced BOMs that have been added.

Fix #16252

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFixed issues not updated by commits (#16254) (#16261)
KN4CK3R [Sat, 26 Jun 2021 12:11:31 +0000 (14:11 +0200)]
Fixed issues not updated by commits (#16254) (#16261)

`UpdateIssuesCommit` may get called with fewer commits because of `FeedMaxCommitNum` and therefore may miss some commands.

3 years agoImprove efficiency in FindRenderizableReferenceNumeric and getReference (#16251)...
zeripath [Sat, 26 Jun 2021 07:31:03 +0000 (08:31 +0100)]
Improve efficiency in FindRenderizableReferenceNumeric and getReference (#16251) (#16255)

* Improve efficiency in FindRenderizableReferenceNumeric and getReferences (#16251)

* The Fuzzer is running on a non-repo urlprefix which is incorrect for RenderRaw
* Make FindRenderizableReferenceNumeric and getReferences more efficient

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* as per comment on original pr

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoUse html.Parse rather than html.ParseFragment (#16223) (#16225)
6543 [Tue, 22 Jun 2021 01:46:39 +0000 (03:46 +0200)]
Use html.Parse rather than html.ParseFragment (#16223) (#16225)

* Use html.Parse rather than html.ParseFragment
  There have been a few issues with html.ParseFragment - just use html.Parse instead.

* Skip document node

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoUpdate milestone counters on new issue (#16183) (#16224)
KN4CK3R [Mon, 21 Jun 2021 22:25:08 +0000 (00:25 +0200)]
Update milestone counters on new issue (#16183) (#16224)

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoreqOrgMembership calls need to be preceded by reqToken (#16198) (#16219)
zeripath [Mon, 21 Jun 2021 15:20:45 +0000 (16:20 +0100)]
reqOrgMembership calls need to be preceded by reqToken (#16198) (#16219)

Backport #16198

ReqOrgMembership calls need to be preceded by reqToken

Fix #16192

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoChangelog v1.14.3 (#16131) v1.14.3
6543 [Fri, 18 Jun 2021 15:25:20 +0000 (17:25 +0200)]
Changelog v1.14.3 (#16131)

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoFix some API bugs (#16184) (#16190)
6543 [Fri, 18 Jun 2021 11:47:34 +0000 (13:47 +0200)]
Fix some API bugs (#16184) (#16190)

* Fix some API bugs (#16184)

* Repository object only count releases as releases (fix #16144)

* EditOrg respect RepoAdminChangeTeamAccess option (fix #16013)

* adjut to v1.14

3 years agoEncrypt migration credentials at rest (#15895) (#16187)
zeripath [Thu, 17 Jun 2021 20:59:28 +0000 (21:59 +0100)]
Encrypt migration credentials at rest (#15895) (#16187)

Backport #15895

Storing these credentials is a liability.

* Encrypt credentials with SECRET_KEY before persisting to task queue table (they need to be persisted due to the nature of the task queue)
  - security in depth: helps when attacker has access to DB only, but not app.ini
* Delete all credentials (even encrypted) from the task table, once the migration is done, for safety
  - security in depth: minimizes leaked data if attacker gains access to snapshot of both DB and app.ini

3 years agoRun processors on whole of text (#16155) (#16185)
zeripath [Thu, 17 Jun 2021 18:01:33 +0000 (19:01 +0100)]
Run processors on whole of text (#16155) (#16185)

Backport #16155

There is an inefficiency in the design of our processors which means that Emoji
and other processors run in order n^2 time.

This PR forces the processors to process the entirety of text node before passing
back up. The fundamental inefficiency remains but it should be significantly
ameliorated.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoissue-keyword class is being incorrectly stripped off spans (#16163) (#16172)
zeripath [Wed, 16 Jun 2021 10:35:54 +0000 (11:35 +0100)]
issue-keyword class is being incorrectly stripped off spans (#16163) (#16172)

Backport #16163

Bluemonday sanitizer regexp rules are not additive, so the addition of the icons,
emojis and chroma syntax policy has led to this being stripped.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoOnly check access tokens if they are likely to be tokens (#16164) (#16171)
zeripath [Wed, 16 Jun 2021 09:06:27 +0000 (10:06 +0100)]
Only check access tokens if they are likely to be tokens (#16164) (#16171)

Backprt #16164

Gitea will currently check every if every password is an access token even though
most passwords are not and cannot be access tokens.

By creation access tokens are 40 byte hexadecimal strings therefore only these should
be checked.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoRemovable media support (#16138)
Andrei Yankovich [Sat, 12 Jun 2021 19:27:16 +0000 (22:27 +0300)]
Removable media support (#16138)

Add support removable media for snap version of gitia.
for get more info about removable media interface see the snapcraft [documentation](https://snapcraft.io/docs/removable-media-interface)

3 years agoSet self-adjusting deadline for connection writing (#16068) (#16123)
zeripath [Thu, 10 Jun 2021 21:26:32 +0000 (22:26 +0100)]
Set self-adjusting deadline for connection writing (#16068) (#16123)

In #16055 it appears that the simple 5s deadline doesn't work for large
file writes. Now we can't - or at least shouldn't just set no deadline
as go will happily let these connections block indefinitely. However,
what seems reasonable is to set some minimum rate we expect for writing.

This PR suggests the following algorithm:

* Every write has a minimum timeout of 5s (adjustable at compile time.)
* If there has been a previous write - then consider its previous
deadline, add half of the minimum timeout + 2s per kb about to written.
* If that new deadline is after the minimum timeout use that.

Fix #16055

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoFix language switch for install page (#16043) (#16128)
a1012112796 [Thu, 10 Jun 2021 13:19:40 +0000 (21:19 +0800)]
Fix language switch for install page (#16043) (#16128)

Signed-off-by: a1012112796 <1012112796@qq.com>
3 years agoFix bug on getIssueIDsByRepoID (#16119) (#16124)
Lunny Xiao [Thu, 10 Jun 2021 05:12:18 +0000 (13:12 +0800)]
Fix bug on getIssueIDsByRepoID (#16119) (#16124)

* Fix bug on getIssueIDsByRepoID

* Add test

3 years agoFix data URI scramble (#16098) (#16118)
6543 [Wed, 9 Jun 2021 14:31:40 +0000 (16:31 +0200)]
Fix data URI scramble (#16098) (#16118)

* Fix data URI scramble (#16098)

* Removed unused method.

* No prefix for data uris.

* Added test to prevent regressions.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
3 years agoFix http path bug (#16117) (#16120)
6543 [Wed, 9 Jun 2021 13:58:00 +0000 (15:58 +0200)]
Fix http path bug (#16117) (#16120)

* Fix http path bug

* Add missed request

* add tests

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoMerge all deleteBranch as one function and also fix bug when delete branch don't...
Lunny Xiao [Mon, 7 Jun 2021 16:27:41 +0000 (00:27 +0800)]
Merge all deleteBranch as one function and also fix bug when delete branch don't close related PRs (#16067) (#16097)

* Fix bug when delete branch don't close related PRs

* Merge all deletebranch as one method

Co-authored-by: Lauris BH <lauris@nix.lv>
3 years agoapi: fix overly strict edit pr permissions (#15900) (#16081)
6543 [Sun, 6 Jun 2021 10:22:05 +0000 (12:22 +0200)]
api: fix overly strict edit pr permissions (#15900) (#16081)

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Norwin <noerw@users.noreply.github.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agogit migration: don't prompt interactively for clone credentials (#15902) (#16082)
6543 [Sun, 6 Jun 2021 06:02:34 +0000 (08:02 +0200)]
git migration: don't prompt interactively for clone credentials (#15902) (#16082)

* don't prompt interactively for clone credentials

* apply GIT_TERMINAL_PROMPT=0 to all git cmds

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Norwin <noerw@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoFix case change in ownernames (#16045) (#16050)
zeripath [Thu, 3 Jun 2021 05:09:43 +0000 (06:09 +0100)]
Fix case change in ownernames (#16045) (#16050)

Backport #16045

If you change the case of a username the change needs to be propagated to their
repositories.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoAdd missing SameSite settings for the i_like_gitea cookie (#16037) (#16039)
zeripath [Tue, 1 Jun 2021 01:33:22 +0000 (02:33 +0100)]
Add missing SameSite settings for the i_like_gitea cookie (#16037) (#16039)

Backport #16037

The i_like_gitea cookie appears to be missing the SameSite settings. I think they
were present at some point but may have been removed in a merge.

This PR ensures that they are set.

Fix #15972

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoDon't manipulate input params in email notification (#16011) (#16033)
Jimmy Praet [Mon, 31 May 2021 06:17:34 +0000 (08:17 +0200)]
Don't manipulate input params in email notification (#16011) (#16033)

Backport #16011

3 years agoFix setting of SameSite on cookies (#15989) (#15991)
techknowlogick [Thu, 27 May 2021 14:02:39 +0000 (10:02 -0400)]
Fix setting of SameSite on cookies (#15989) (#15991)

Fix #15972

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agofollow redirect when fetching theme archive (#15986) (#15990)
techknowlogick [Thu, 27 May 2021 01:05:24 +0000 (21:05 -0400)]
follow redirect when fetching theme archive (#15986) (#15990)

3 years agoRemove branch URL before IssueRefURL (#15970)
fnetX (aka fralix) [Tue, 25 May 2021 20:02:19 +0000 (22:02 +0200)]
Remove branch URL before IssueRefURL (#15970)

Revert change for account / org dashboard where IssueRefURLs do not
contain the full repo URL (case RepoLink is not true)

Co-authored-by: Norwin <noerw@users.noreply.github.com>
Co-authored-by: Norwin <noerw@users.noreply.github.com>
3 years agofix layout of milestone view (#15940)
Tomás Warynyca [Sat, 22 May 2021 02:38:51 +0000 (23:38 -0300)]
fix layout of milestone view (#15940)

3 years agoRestore PAM user autocreation functionality (#15825) (#15867)
zeripath [Wed, 19 May 2021 14:42:36 +0000 (15:42 +0100)]
Restore PAM user autocreation functionality (#15825) (#15867)

Backport #15825

* Restore PAM user autocreation functionality

PAM autoregistration of users currently fails due to email invalidity.
This PR adds a new setting to PAM to allow an email domain to be set
or just sets the email to the noreply address and if that fails falls
back to uuid@localhost

Fix #15702

Signed-off-by: Andrew Thornton <art27@cantab.net>
* As per KN4CKER

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoremove unimplemented searchbar from project view (#15905)
Norwin [Mon, 17 May 2021 11:22:08 +0000 (11:22 +0000)]
remove unimplemented searchbar from project view (#15905)

3 years agoMove sans-serif fallback font higher than emoji fonts (#15855) (#15892)
zeripath [Sun, 16 May 2021 13:42:12 +0000 (14:42 +0100)]
Move sans-serif fallback font higher than emoji fonts (#15855) (#15892)

Backport #15855

The Tor browser does not use the system-ui font and no other fonts in the stack match
its default fonts. In fact it is possible that it will in future only
match generic fonts. This means that all rendering will first try the
emoji fonts before falling back to the sans-serif font for glyphs.

In this case has the emoji fall back fonts for Tor contains empty glyphs
for numbers - in order to protect privacy - and leads to numbers being
rendered as empty glyphs. This is clearly not ideal and whilst we could
use the Arimo font - as I state above I suspect that Tor will eventually
ban detecting this and we should instead move the sans-serif font higher
in the stack so that it matches before the emoji fonts.

Partial fix of #15844

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoGitHub: migrate draft releases too (#15884) (#15888)
6543 [Sun, 16 May 2021 07:24:28 +0000 (09:24 +0200)]
GitHub: migrate draft releases too (#15884) (#15888)

* GitHub: migrate draft releases too

* refactor

3 years agoClose the gitrepo when deleting the repository (#15876) (#15887)
6543 [Sat, 15 May 2021 21:45:17 +0000 (23:45 +0200)]
Close the gitrepo when deleting the repository (#15876) (#15887)

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoUpgrade xorm to v1.1.0 (#15869) (#15885)
Lunny Xiao [Sat, 15 May 2021 18:32:17 +0000 (02:32 +0800)]
Upgrade xorm to v1.1.0 (#15869) (#15885)

3 years agoFix bound address/port for caddy's certmagic library (see #15848) (#15859) (#15878)
zeripath [Sat, 15 May 2021 17:28:14 +0000 (18:28 +0100)]
Fix bound address/port for caddy's certmagic library (see #15848) (#15859) (#15878)

Co-authored-by: Blake Miner <miner.blake@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoFix blame row height alignment (#15863) (#15883)
Norwin [Sat, 15 May 2021 16:12:07 +0000 (16:12 +0000)]
Fix blame row height alignment (#15863) (#15883)

* fix blame row alignment on firefox
* fix blame row alignment in chrome
* fix blame row alignment in safari

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoFix error message when saving generated LOCAL_ROOT_URL config (#15880) (#15882)
Naohisa Murakami [Sat, 15 May 2021 14:06:39 +0000 (23:06 +0900)]
Fix error message when saving generated LOCAL_ROOT_URL config (#15880) (#15882)

Backport of #15880.

3 years agoOnly write config in environment-to-ini if there are changes (#15861) (#15868)
zeripath [Sat, 15 May 2021 12:07:16 +0000 (13:07 +0100)]
Only write config in environment-to-ini if there are changes (#15861) (#15868)

Backport #15861

* Only write config in environment-to-ini if there are changes

Only write the new config in environment-to-ini if there are changes or the
destination is not the same as the customconf.

Fix #15719
Fix #15857

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoReturn go-get info on subdirs (#15642) (#15871)
zeripath [Sat, 15 May 2021 11:06:02 +0000 (12:06 +0100)]
Return go-get info on subdirs (#15642) (#15871)

Backport #15642

This PR is an alternative to #15628 and makes the go get handler a
handler.

Fix #15625

Close #15628

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoAdd timeout to writing to responses (#15831) (#15872)
zeripath [Fri, 14 May 2021 16:42:27 +0000 (17:42 +0100)]
Add timeout to writing to responses (#15831) (#15872)

Backport #15831

In #15826 it has become apparent that there are a few occasions when a response can
hang during writing, and because there is no timeout go will happily just block
interminably. This PR adds a fixed 5 second timeout to all writes to a connection.

Fix #15826

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFix LFS commit finder not working (#15856) (#15874)
KN4CK3R [Fri, 14 May 2021 15:39:59 +0000 (17:39 +0200)]
Fix LFS commit finder not working (#15856) (#15874)

* Create a copy of the sha bytes.

Co-authored-by: Andrew Thornton <art27@cantab.net>
3 years agoStop calling WriteHeader in Write (#15862) (#15873)
zeripath [Fri, 14 May 2021 14:38:35 +0000 (15:38 +0100)]
Stop calling WriteHeader in Write (#15862) (#15873)

Backport #15862

Fixes http: superfluous response.WriteHeader call from code.gitea.io/gitea/modules/context.(*Response).WriteHeader (response.go:67)

* Looking again we don't need this writeHeader as all of our downstream
implementations will always do it for us

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoOnly offer hostcertificates if they exist (#15849) (#15853)
zeripath [Thu, 13 May 2021 15:12:41 +0000 (16:12 +0100)]
Only offer hostcertificates if they exist (#15849) (#15853)

Backport #15849

A common bug report is the otherwise harmless sshd logging:

```
Could not load host certificate "/data/ssh/ssh_host_ed25519_cert": No such file or directory
```

This PR simply checks if these files exist before creation of sshd_config and if
they do not exist, doesn't add a reference to them.

Fix #14110 amongst others.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: 6543 <6543@obermui.de>
3 years agofix truncate utf8 string (#15828) (#15854)
zeripath [Thu, 13 May 2021 14:10:29 +0000 (15:10 +0100)]
fix truncate utf8 string (#15828) (#15854)

Backport #15828

* fix truncate utf8 string.

* revoke truncated user info.

Co-authored-by: yan <sxty32@gmail.com>
3 years agoFix bound address/port for caddy's certmagic library (#15758) (#15848)
zeripath [Wed, 12 May 2021 22:36:46 +0000 (23:36 +0100)]
Fix bound address/port for caddy's certmagic library (#15758) (#15848)

Backport #15758

* Fix bound address/port for caddy's certmagic library

* Fix bug

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Blake Miner <miner.blake@gmail.com>
3 years agochange s3 bucket name (#15847)
techknowlogick [Wed, 12 May 2021 20:12:36 +0000 (16:12 -0400)]
change s3 bucket name (#15847)

3 years agoUpgrade unrolled/render to v1.1.1 (#15845) (#15846)
zeripath [Wed, 12 May 2021 19:54:50 +0000 (20:54 +0100)]
Upgrade unrolled/render to v1.1.1 (#15845) (#15846)

Backport #15845

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoTagger can be empty, as can Commit and Author - tolerate this (#15835) (#15839)
zeripath [Wed, 12 May 2021 19:09:16 +0000 (20:09 +0100)]
Tagger can be empty, as can Commit and Author - tolerate this (#15835) (#15839)

Backport #15835

Unfortunately some old repositories can have tags with empty Tagger, Commit
or Author. Go-Git variants will always have empty values for these whereas
the native git variant leaves them at nil. The simplest solution is just to
always have these set to empty Signatures.

v156 migration also makes the incorrect assumption that these cannot be empty.
Therefore add some handling to this and add logging and adjust broken
logging elsewhere in this migration.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoQueue manager FlushAll can loop rapidly - add delay (#15733) (#15840)
zeripath [Wed, 12 May 2021 17:48:11 +0000 (18:48 +0100)]
Queue manager FlushAll can loop rapidly - add delay (#15733) (#15840)

Backport #15733

* Queue manager FlushAll can loop rapidly - add delay

Add delay within FlushAll to prevent rapid loop when workers are busy

Signed-off-by: Andrew Thornton <art27@cantab.net>
* as per lunny

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoSet autocomplete off on branches selector (#15809) (#15833)
zeripath [Tue, 11 May 2021 22:18:07 +0000 (23:18 +0100)]
Set autocomplete off on branches selector (#15809) (#15833)

Backport #15809

Fix #15782

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoAdd err to log (#15813) (#15824)
John Olheiser [Mon, 10 May 2021 20:38:37 +0000 (15:38 -0500)]
Add err to log (#15813) (#15824)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
3 years agoMove restore repo to internal router and invoke from command to avoid open the same...
Lunny Xiao [Mon, 10 May 2021 13:14:59 +0000 (21:14 +0800)]
Move restore repo to internal router and invoke from command to avoid open the same db file or queues files (#15790) (#15816)

* Move restore repo to internal router and invoke from command to avoid open the same db file or queues files

* Follow @zeripath's review

* set no timeout for resotre repo private request

* make restore repo cancelable

3 years agoTests should use test files (#15801) (#15806)
6543 [Sun, 9 May 2021 17:39:14 +0000 (19:39 +0200)]
Tests should use test files (#15801) (#15806)

3 years agoChangelog v1.14.2 (#15794) v1.14.2
6543 [Sun, 9 May 2021 09:26:49 +0000 (11:26 +0200)]
Changelog v1.14.2 (#15794)

* changelog tool generate

* format & add

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoEnsure that ctx.Written is checked after issues(...) calls (#15797) (#15798)
6543 [Sun, 9 May 2021 08:48:52 +0000 (10:48 +0200)]
Ensure that ctx.Written is checked after issues(...) calls (#15797) (#15798)

Fix issue noted in #15783

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoDisplay conflict-free merge messages for pull requests (#15773) (#15796)
zeripath [Sun, 9 May 2021 02:32:48 +0000 (03:32 +0100)]
Display conflict-free merge messages for pull requests (#15773) (#15796)

Backport #15773

Repositories using external issue tracker tend to use numeric issues in
commits. To prevent conflicts during issue reference parsing or inside
commit hooks, this change respects these configuration and uses the !
character to refer to pull requests in merge commit messages.

For repositories using squash merges, this was already handled.

Signed-off-by: JustusBunsi <61625851+justusbunsi@users.noreply.github.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Steven <61625851+justusbunsi@users.noreply.github.com>
3 years agoExponential Backoff for ByteFIFO (#15724) (#15793)
6543 [Sat, 8 May 2021 18:27:00 +0000 (20:27 +0200)]
Exponential Backoff for ByteFIFO (#15724) (#15793)

This PR is another in the vein of queue improvements. It suggests an
exponential backoff for bytefifo queues to reduce the load from queue
polling. This will mostly be useful for redis queues.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
3 years ago[API] make change repo settings work on empty repos (#15778) (#15789)
6543 [Sat, 8 May 2021 13:14:42 +0000 (15:14 +0200)]
[API] make change repo settings work on empty repos (#15778) (#15789)

* API: Fix #15602

* Add TEST

3 years agoUse pulls in commit graph unless pulls are disabled (#15734 & #15740 & #15774) (...
6543 [Fri, 7 May 2021 19:12:24 +0000 (21:12 +0200)]
Use pulls in commit graph unless pulls are disabled (#15734 & #15740 & #15774) (#15775)

* Commit Graph: Pull-Requests should not link to issues (#15734)

Use `/pulls` and simplify code.

* reverse #15734 partial and comment (#15740)

* reverse & comment

* Update templates/repo/graph/commits.tmpl

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
* Use pulls in commit graph unless pulls are disabled

Fix #15370

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: KN4CK3R <KN4CK3R@users.noreply.github.com>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoSet GIT_DIR correctly if it is not set (#15751) (#15769)
6543 [Fri, 7 May 2021 18:01:25 +0000 (20:01 +0200)]
Set GIT_DIR correctly if it is not set (#15751) (#15769)

* Set GIT_DIR correctly if it is not set

* Expand out templates

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoDefer closing the gitrepo until the end of the wrapped context functions (#15653...
zeripath [Fri, 7 May 2021 16:28:02 +0000 (17:28 +0100)]
Defer closing the gitrepo until the end of the wrapped context functions (#15653) (#15746)

* Defer closing the gitrepo until the end of the wrapped context functions (#15653)

Backport #15653

There was a mistake in #15372 where deferral of gitrepo close occurs before it should.

This PR fixes this.

3 years agoDrop back to use IsAnInteractiveSession for SVC (#15749) (#15762)
zeripath [Fri, 7 May 2021 15:44:35 +0000 (16:44 +0100)]
Drop back to use IsAnInteractiveSession for SVC (#15749) (#15762)

Backport #15749

* Drop back to use IsAnInteractiveSession for SVC

There is an apparent permission change problem when using
IsWindowsService to determine if the SVC manager should be
used.

This PR simply drops back to using IsAnInteractiveSession as
this does not change behaviour.

Fix #15454

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Yes staticcheck I know this is deprecated

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Just leave me alone lint

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoFix bug where repositories appear unadopted (#15757) (#15767)
6543 [Fri, 7 May 2021 15:07:39 +0000 (17:07 +0200)]
Fix bug where repositories appear unadopted (#15757) (#15767)

Fix bug where repositories with capital letters in their names appear unadopted.

Fix #15755

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agonot show `ref-in-new-issue` pop when issue was disabled (#15761) (#15765)
6543 [Fri, 7 May 2021 14:13:20 +0000 (16:13 +0200)]
not show `ref-in-new-issue` pop when issue was disabled (#15761) (#15765)

fix #15718

Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: a1012112796 <1012112796@qq.com>
3 years agoIssue list alignment tweaks (#15483) (#15766)
6543 [Fri, 7 May 2021 13:06:19 +0000 (15:06 +0200)]
Issue list alignment tweaks (#15483) (#15766)

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoFix setting version table in dump (#15753) (#15759)
zeripath [Fri, 7 May 2021 12:04:17 +0000 (13:04 +0100)]
Fix setting version table in dump (#15753) (#15759)

Backport #15753

* Fix setting version table in dump

As noted on Discord there is a problem with gitea dump where the version table
is not being dumped correctly.

This is due to a missing pointer in the TableInfo.

This PR fixes this.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update models_test.go

3 years agoFix close button change on delete in simplemde area (#15737) (#15747)
zeripath [Thu, 6 May 2021 22:14:15 +0000 (23:14 +0100)]
Fix close button change on delete in simplemde area (#15737) (#15747)

Backport #15737

* Fix close button change on delete in simplemde area

Fix issue with close button changing when deleting in the simplemde textarea.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* apply suggestion

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: 6543 <6543@obermui.de>
3 years agofix some ui bug about draft release (#15137) (#15745)
a1012112796 [Thu, 6 May 2021 19:23:26 +0000 (03:23 +0800)]
fix some ui bug about draft release (#15137) (#15745)

* fix some ui bug about draft release

- should not show draft release in tag list because
  it will't create real tag
- still show draft release without tag and commit message
  for draft release instead of 404 error
- remove tag load for attachement links because it's useless

Signed-off-by: a1012112796 <1012112796@qq.com>
* add test code

* fix test

That's because has added a new release in relaese test database.

* fix dropdown link for draft release

3 years agoFix webkit calendar icon color on arc-green (#15728)
Tomás Warynyca [Wed, 5 May 2021 05:10:01 +0000 (02:10 -0300)]
Fix webkit calendar icon color on arc-green (#15728)

3 years agoOnly log Error on getLastCommitStatus error to let pull list still be visible (#15715)
6543 [Tue, 4 May 2021 12:03:31 +0000 (14:03 +0200)]
Only log Error on getLastCommitStatus error to let pull list still be visible (#15715)

3 years agoMove tooltip down to allow selection of Remove File on error (#15672) (#15714)
Kyle D [Tue, 4 May 2021 06:00:29 +0000 (00:00 -0600)]
Move tooltip down to allow selection of Remove File on error (#15672) (#15714)

3 years agoFix setting redis db path (#15698) (#15708)
zeripath [Mon, 3 May 2021 21:30:30 +0000 (22:30 +0100)]
Fix setting redis db path (#15698) (#15708)

Backport #15698

There is a bug setting the redis db in the common nosql manager whereby the db path
always fails.

This PR fixes this.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoImplement delete release attachments and update release attachments' name (#14130...
Kyle D [Mon, 3 May 2021 17:27:00 +0000 (11:27 -0600)]
Implement delete release attachments and update release attachments' name (#14130) (#15666)

* Implement delete release attachment

* Add attachments on release edit page

* Fix bug

* Finish del release attachments

* Fix frontend lint

* Fix tests

* Support edit release attachments

* Added tests

* Remove the unnecessary parameter isCreate from UpdateReleaseOrCreatReleaseFromTag

* Rename UpdateReleaseOrCreatReleaseFromTag to UpdateRelease

* Fix middle align

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoPerformance improvement for last commit cache and show-ref (#15455) (#15701)
zeripath [Mon, 3 May 2021 14:51:41 +0000 (15:51 +0100)]
Performance improvement for last commit cache and show-ref (#15455) (#15701)

Backport #15455

* Improve performance when there are multiple commits in the last commit cache

* read refs directly if we can

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFix DB session cleanup (#15697) (#15700)
zeripath [Sun, 2 May 2021 09:43:01 +0000 (10:43 +0100)]
Fix DB session cleanup (#15697) (#15700)

Backport #15697

The DB session clean up needs to check expiry not created_unix.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFixed several activation bugs (#15473) (#15685)
6543 [Sat, 1 May 2021 00:14:36 +0000 (02:14 +0200)]
Fixed several activation bugs (#15473) (#15685)

* Removed unneeded form tag.

* Fixed typo.

* Fixed NPE.

* Use better error page.

* Splitted GET and POST.

Co-authored-by: KN4CK3R <KN4CK3R@users.noreply.github.com>
3 years agoDelete references if repository gets deleted (#15681) (#15684)
6543 [Fri, 30 Apr 2021 22:09:58 +0000 (00:09 +0200)]
Delete references if repository gets deleted (#15681) (#15684)

* Remove DeletedBranch and LFSLocks.

* Sort beans.

Co-authored-by: KN4CK3R <KN4CK3R@users.noreply.github.com>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoFix orphaned objects deletion bug (#15657) (#15683)
6543 [Fri, 30 Apr 2021 21:27:26 +0000 (23:27 +0200)]
Fix orphaned objects deletion bug (#15657) (#15683)

* Fix orphaned objects deletion bug

* extend test

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoDelete protected branch if repository gets removed (#15658) (#15676)
KN4CK3R [Fri, 30 Apr 2021 18:59:42 +0000 (20:59 +0200)]
Delete protected branch if repository gets removed (#15658) (#15676)

* Added missing error parameters.

* Delete protected branch if repository gets removed.

* Added doctor fix.

3 years ago[API] pull notification subject status: add "merged" (#15344) (#15654)
6543 [Wed, 28 Apr 2021 19:24:56 +0000 (21:24 +0200)]
[API] pull notification subject status: add "merged" (#15344) (#15654)

Current subject status can be "", "open" and "closed". This add "merged" to it.