Commit graph

17033 commits

Author SHA1 Message Date
Gusted
6c100083c2
[BUG] Restrict when to make link absolute in markdown
- Backport of #2403
- In markdown, links are proccessed to be made absolute against the
relevant base in that context. Such that `./src` will be transformed
into `http://example.com/owner/repo/src/branch/main/src`.
- Don't try to make the link absolute if the link has a schema that's
defined in `[markdown].CUSTOM_URL_SCHEMES`, because they can't be made
absolute and doing so could lead to problems (see test case, double
slash was transformed to single slash).
- Adds unit test.
- Resolves https://codeberg.org/Codeberg/Community/issues/1489

(cherry picked from commit 65b9a959b8)
2024-02-19 23:30:12 +01:00
Earl Warren
6c5121aac5 Merge pull request '[GITEA] Fix cancelled migration deletion modal' (#2405) from gusted/forgejo-bp-1805 into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2405
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-19 21:55:09 +00:00
Gusted
53460829f7
[GITEA] Fix cancelled migration deletion modal
- Backport of #1805
- https://codeberg.org/forgejo/forgejo/pulls/1473 made that dangerous
actions such as deletion also would need to type in the owner's name.
This was apparently not reflected to the deletion modal for migrations
that failed or were cancelled.
- Resolves #2404

(cherry picked from commit c38dbd6f88)
2024-02-19 21:00:26 +01:00
Gusted
84ef9bba44 Merge pull request '[BUG] Fix relative links on orgmode' (#2391) from gusted/forgejo-bp-2385 into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2391
Reviewed-by: Otto <otto@codeberg.org>
2024-02-19 12:29:21 +00:00
Gusted
fa700333ba
[BUG] Fix relative links on orgmode
- Backport of #2385
- For regular non-image nonvideo links, they should be made relative,
this was done against `r.Ctx.Links.Base`, but since 637451a45e, that
should instead be done by `SrcLink()` if there's branch information set
in the context, because branch and treepath information are no longer
set in `r.Ctx.Links.Base`.
- This is consistent with how #2166 _fixed_ relative links.
- Media is not affected, `TestRender_Media` test doesn't fail.
- Adds unit tests.
- Ref https://codeberg.org/Codeberg/Community/issues/1485

(cherry picked from commit a2442793d2)
2024-02-19 12:15:40 +01:00
Earl Warren
cd8a59e7bd Merge pull request '[BUG] Fix Ctrl+Enter on submitting review comment' (#2374) from gusted/forgejo-bp-2370 into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2374
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-17 16:25:27 +00:00
Gusted
1c3a31d851
[BUG] Fix Ctrl+Enter on submitting review comment
- Backport of #2370
- When a event is caused by `Ctrl+Enter` jQuery might not wrap the event
and in that case `originalEvent` is not defined. Check for this case.
- Log the error along with showing an toast.
- Resolves #2363

(cherry picked from commit f04589defd)
2024-02-17 16:19:21 +01:00
Earl Warren
8283305d53 Merge pull request '[BUG] split code conversations in diff tab' (#2362) from oliverpool/forgejo:bg2306 into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2362
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-02-17 10:50:48 +00:00
Earl Warren
91703b7214 Merge pull request 'Preview: set font-size on preview content' (#2366) from gusted/forgejo-bp-2349 into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2366
Reviewed-by: Otto <otto@codeberg.org>
2024-02-17 10:48:33 +00:00
Gusted
a904558380
Preview: set font-size on preview content
- Backport of #2349
- When previewing the content in a review, no font size was set. This
resulted in the previewed content being bigger than other text and
therefor creating an noticable inconsistency.
- Set the font size of the previewed content, 14px, this is consistent
with how the content would be rendered.
- `comment-code-cloud` is the class used for the review boxes.
`.ui.tab.markup` means it only applies to the preview tab.

(cherry picked from commit b1aabbf174)
2024-02-16 22:29:12 +01:00
oliverpool
07bc099401 [BUG] split code conversations in diff tab (#2306)
Follow-up of #2282 and #2296 (which tried to address #2278)

One of the issue with the previous PR is that when a conversation on the Files tab was marked as "resolved", it would fetch all the comments for that line (even the outdated ones, which should not be shown on this page - except when explicitly activated).

To properly fix this, I have changed `FetchCodeCommentsByLine` to `FetchCodeConversation`. Its role is to fetch all comments related to a given (review, path, line) and reverted my changes in the template (which were based on a misunderstanding).

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2306
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: oliverpool <git@olivier.pfad.fr>
Co-committed-by: oliverpool <git@olivier.pfad.fr>
2024-02-16 14:06:43 +01:00
Earl Warren
45c0fa4905 Merge pull request '[BUG] Workaround borked Git version' (#2342) from gusted/forgejo-bp-2335 into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2342
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-14 10:55:22 +00:00
Earl Warren
31ca6d8160 Merge pull request '[gitea] v1.21 cherry-pick' (#2340) from earl-warren/forgejo:wip-v1.21-forgejo into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2340
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-02-14 10:54:42 +00:00
Gusted
ff468ab5e4
[BUG] Workaround borked Git version
- Backport #2335
- In Git version v2.43.1, the behavior of `GIT_FLUSH` was accidentially
flipped. This causes Forgejo to hang on the `check-attr` command,
because no output was being flushed.
- Workaround this by detecting if Git v2.43.1 is used and set
`GIT_FLUSH=0` thus getting the correct behavior.
- Ref: https://lore.kernel.org/git/CABn0oJvg3M_kBW-u=j3QhKnO=6QOzk-YFTgonYw_UvFS1NTX4g@mail.gmail.com/
- Resolves #2333.

(cherry picked from commit f68f880974)
2024-02-13 21:07:24 +01:00
CEnnis91
fab6780fda
Fix swift packages not resolving (#29095) (#29102)
(cherry picked from commit 1aaeec6da7fdbbe363e417a0445f21ed3b750aba)
2024-02-13 14:29:41 +01:00
Giteabot
614ba2b257
Avoid showing unnecessary JS errors when there are elements with different origin on the page (#29081) (#29089)
Backport #29081 by wxiaoguang

Try to fix #29080

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 9a4d283e9ac472dca869356c27db05039673c638)
2024-02-13 14:18:07 +01:00
Giteabot
628e1036cf
Fix gitea-origin-url with default ports (#29085) (#29088)
Backport #29085 by @silverwind

When setting `url.host` on a URL object with no port specified (like is
the case of default port), the resulting URL's port will not change.
Workaround this quirk in the URL standard by explicitely setting port
for the http and https protocols.

Extracted the logic to a function for the purpose of testing. Initially
I wanted to have the function in utils.js, but it turns out esbuild can
not treeshake the unused functions which would result in the
webcomponents chunk having all 2kB utils.js inlined, so it seemed not
worth.

Fixes: https://github.com/go-gitea/gitea/issues/29084

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit fb7f28e9a7ee441e85dc957ac507278650af2f63)
2024-02-13 14:17:58 +01:00
Giteabot
e6f59f6e14
fix: Elasticsearch: Request Entity Too Large #28117 (#29062) (#29075)
Backport #29062 by @inferno-umar

Fix for gitea putting everything into one request without batching and
sending it to Elasticsearch for indexing as issued in #28117

This issue occured in large repositories while Gitea tries to
index the code using ElasticSearch.

Co-authored-by: dark-angel <70754989+inferno-umar@users.noreply.github.com>
(cherry picked from commit f0d34cd3b97dd2c9f29fc401ec58ea0661b7ca7d)
2024-02-13 14:17:49 +01:00
Giteabot
941c47f08f
Hide code links on release page if user cannot read code (#29064) (#29066)
Backport #29064 by @wolfogre

On the release list page, if the user doesn't have the permission to
read code, the code links will lead to 404 pages or api errors:

<img width="1297" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/a74fbc63-6dd6-43c6-853c-28acdbfdcb4e">

After this PR:

<img width="1297" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/a626373d-c2df-40a9-8fed-1b12ff6bc56f">

And this PR also removed some dead code. After #23465, the tag list page
has an independent template, and all `IsTag` in the release list
template are always false.

Co-authored-by: Jason Song <i@wolfogre.com>
(cherry picked from commit 7ed79b748f772e931317f941390695be3ac0d0bd)
2024-02-13 14:17:43 +01:00
Giteabot
3c54a1dbf6
Avoid sending update/delete release notice when it is draft (#29008) (#29025)
Backport #29008 by @yp05327

Fix #27157

Co-authored-by: yp05327 <576951401@qq.com>
(cherry picked from commit 8def405047)
2024-02-13 14:17:34 +01:00
Giteabot
8c20eb668b
Wrap contained tags and branches again (#29021) (#29026)
Backport #29021 by @delvh

Fixes #29016

## After

![grafik](https://github.com/go-gitea/gitea/assets/51889757/2c72ee8f-439e-4328-85df-77772e0f4aef)

Co-authored-by: delvh <dev.lh@web.de>
(cherry picked from commit 5ac41026f9)
2024-02-13 14:17:25 +01:00
Giteabot
565b4efe4d
Fix incorrect button CSS usages (#29015) (#29023)
Backport #29015 by @wxiaoguang

Fix 2 problems:

1. Remove the legacy (non-existing) CSS: `class="btn btn-gray
btn-radius"`
2. Remove the button styles inside the `ui message`, according to:
https://fomantic-ui.com/collections/message.html , the button shouldn't
have any border/padding.

### Before

![image](https://github.com/go-gitea/gitea/assets/2114189/4c7e98e2-4e8a-493f-9b7e-446a365066a1)

![image](https://github.com/go-gitea/gitea/assets/2114189/05221251-7a79-4c96-8973-fb4588275672)

### After

![image](https://github.com/go-gitea/gitea/assets/2114189/8bc3edbc-42a6-40bd-85fd-de40e94841d4)

![image](https://github.com/go-gitea/gitea/assets/2114189/93f69143-d835-437c-b5eb-0f6dddde97a1)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 333d02ddfd)
2024-02-13 14:17:18 +01:00
Giteabot
c148156409
Strip trailing newline in markdown code copy (#29019) (#29022)
Behaviour now matches GH. Safeguard added in the for loop because
`textContent` may be null in which case it does not make sense to render
the copy button.

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 5d1abdce3e)
2024-02-13 14:17:07 +01:00
Earl Warren
bb5f4fd81b Merge pull request '[ACTIONS] skip superflous pull request synchronized event (#2314)' (#2338) from earl-warren/forgejo:wip-v1.21-superfluous into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2338
2024-02-13 12:37:58 +00:00
Earl Warren
ce96379aef
[ACTIONS] skip superflous pull request synchronized event (#2314)
Skip a HookEventPullRequestSync event if it has the same CommitSHA as an existing HookEventPullRequest event in the ActionRun table. A HookEventPullRequestSync event must only create an ActionRun if the CommitSHA is different from what it was when the PR was open.

This guards against a race that can happen when the following is done in parallel:

* A commit C is pushed to a repo on branch B
* A pull request with head on branch B

it is then possible that the pull request is created first, successfully. The commit that was just pushed is not known yet but the PR only references the repository and the B branch so it is fine.

A HookEventPullRequest event is sent to the notification queue but not processed immediately.

The commit C is pushed and processed successfully. Since the PR already exists and has a head that matches the branch, the head of the PR is updated with the commit C and a HookEventPullRequestSync event is sent to the notification queue.

The HookEventPullRequest event is processed and since the head of the PR was updated to be commit C, an ActionRun with CommitSHA C is created.

The HookEventPullRequestSync event is then processed and also has a CommitSHA equal to C.

Refs: https://codeberg.org/forgejo/forgejo/issues/2009
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2314
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
(cherry picked from commit 7b4dba3aa0)

Conflicts:
	services/actions/notifier_helper.go
	tests/integration/actions_trigger_test.go
	trivial context conficts
	services/actions/main_test.go is different in v1.21
2024-02-13 12:00:27 +01:00
Earl Warren
5697a6e82f Merge pull request '[CI] pin go v1.21' (#2318) from earl-warren/forgejo:wip-v1.21-ci into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2318
2024-02-09 17:48:18 +00:00
Earl Warren
9a61bcb91f
[CI] pin go v1.21 2024-02-09 18:11:08 +01:00
Earl Warren
38800476bd Merge pull request '[GITEA] Generate install if condition for Alpine' (#2286) from earl-warren/forgejo:wip-v1.21-alpine into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2286
2024-02-04 19:23:15 +00:00
oliverpool
f8fe66d737 Merge pull request '[GITEA] Internal Server Error when resolving comments' (#2289) from oliverpool/forgejo:forgejo-bp-2282 into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2289
Reviewed-by: crystal <crystal@noreply.codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-04 14:15:08 +00:00
oliverpool
ad67d9ef1a [GITEA] always load outdated comments 2024-02-04 12:44:13 +01:00
oliverpool
d5bb14de66 [GITEA] add test showing bug on resolving invalidated review comment 2024-02-04 12:44:13 +01:00
Gusted
7afbc62057
[GITEA] Generate install if condition for Alpine
- If the APKINFO contains an install if condition, write it in the APKINDEX.
- No integration testing, as I don't have the files to regenerate the
hardcoded compressed(?) APKINFO in the test.
- Resolves #2174

(cherry picked from commit 11da776bef)
(cherry picked from commit 2824ae4cf2)
2024-02-03 19:30:48 +01:00
Gusted
d56bb1bc95 Merge pull request '[GITEA] Fix orgmode link resolver for text descriptions' (#2277) from gusted/forgejo-bp-2276 into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2277
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-01 21:05:22 +00:00
Earl Warren
108c984945 Merge pull request 'Revert "Speed up loading the dashboard on mysql/mariadb (#28546)" (#29006) (#29007)' (#2279) from earl-warren/forgejo:wip-v1.21-performance into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2279
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-02-01 21:02:25 +00:00
Giteabot
af98a0a7c6
Revert "Speed up loading the dashboard on mysql/mariadb (#28546)" (#29006) (#29007)
Backport #29006 by @lunny

This reverts commit fa8c3beb26. #28546
Because it seems performance become worse.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit a0b9bd2feb)
2024-02-01 20:56:23 +01:00
Gusted
781d2a68cc
[GITEA] Fix orgmode link resolver for text descriptions
- Backport of #2276
- It's possible that the description of an `Regularlink` is `Text` and not
another `Regularlink`. Therefor if it's `Text`, convert it to an
`Regularlink` trough the 'old' behavior (pass it trough `org.String` and
trim `file:` prefix).
- Adds unit tests.
- Resolves https://codeberg.org/Codeberg/Community/issues/1430

(cherry picked from commit 385fc6ee6b)
2024-02-01 17:13:22 +01:00
6543
faafccbcc7
Update go dependencies and fix go-git (#28893) (#28934)
Backport #28893

(cherry picked from commit c33886b710)

Conflicts:
	go.sum
	trivial conflict because of 120294c44e * [GITEA] Use maintained gziphandler
2024-01-31 16:46:41 +01:00
Earl Warren
ee833fc011
[SEMVER] 6.0.5+0-gitea-1.21.5 2024-01-31 14:18:26 +01:00
Giteabot
7578022870
Don't remove all mirror repository's releases when mirroring (#28817) (#28939)
Backport #28817 by @lunny

Fix #22066

# Purpose

This PR fix the releases will be deleted when mirror repository sync the
tags.

# The problem

In the previous implementation of #19125. All releases record in
databases of one mirror repository will be deleted before sync.
Ref:
https://github.com/go-gitea/gitea/pull/19125/files#diff-2aa04998a791c30e5a02b49a97c07fcd93d50e8b31640ce2ddb1afeebf605d02R481

# The Pros

This PR introduced a new method which will load all releases from
databases and all tags on git data into memory. And detect which tags
needs to be inserted, which tags need to be updated or deleted. Only
tags releases(IsTag=true) which are not included in git data will be
deleted, only tags which sha1 changed will be updated. So it will not
delete any real releases include drafts.

# The Cons

The drawback is the memory usage will be higher than before if there are
many tags on this repository. This PR defined a special release struct
to reduce columns loaded from database to memory.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit 2048363f9e)
2024-01-31 14:18:26 +01:00
Giteabot
b272224918
Preserve BOM in web editor (#28935) (#28959)
Backport #28935 by @silverwind

The `ToUTF8*` functions were stripping BOM, while BOM is actually valid
in UTF8, so the stripping must be optional depending on use case. This
does:

- Add a options struct to all `ToUTF8*` functions, that by default will
strip BOM to preserve existing behaviour
- Remove `ToUTF8` function, it was dead code
- Rename `ToUTF8WithErr` to `ToUTF8`
- Preserve BOM in Monaco Editor
- Remove a unnecessary newline in the textarea value. Browsers did
ignore it, it seems but it's better not to rely on this behaviour.

Fixes: https://github.com/go-gitea/gitea/issues/28743
Related: https://github.com/go-gitea/gitea/issues/6716 which seems to
have once introduced a mechanism that strips and re-adds the BOM, but
from what I can tell, this mechanism was removed at some point after
that PR.

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit b8e6cffd31)
2024-01-31 14:18:26 +01:00
Giteabot
afdce6bd45
Strip / from relative links (#28932) (#28952)
Backport #28932 by @KN4CK3R

Fixes #28915

Restores the old behaviour:

https://github.com/go-gitea/gitea/pull/26745/files#diff-d78a9d361b1fddc12218e4dd42f42d39d6be1fda184041e06bb6fb30f0d94c59L96

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit 1ddcaedb88)
2024-01-31 14:18:26 +01:00
Giteabot
253af55053
Make loading animation less aggressive (#28955) (#28956)
Backport #28955 by @yardenshoham

The current animation loops in a very fast manner, causing a slight
feeling of uncomfortableness. This change slows it a bit for a smoother
experience.

# Before

![before](https://github.com/go-gitea/gitea/assets/20454870/215a722d-feb4-4643-819d-c37a620c5e48)

# After

![after](https://github.com/go-gitea/gitea/assets/20454870/7acb1fab-9157-4f4d-8cc7-45fea0234b47)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Yarden Shoham <git@yardenshoham.com>
(cherry picked from commit 7291fecab3)
2024-01-31 14:18:26 +01:00
Giteabot
c69d8c53f5
fix: update enable_prune even if mirror_interval is not provided (#28905) (#28929)
Backport #28905 by @Anthony-Jhoiro

Currently, the `updateMirror` function which update the mirror interval
and enable prune properties is only executed by the `Edit` function. But
it is only triggered if `opts.MirrorInterval` is not null, even if
`opts.EnablePrune` is not null.

With this patch, it is now possible to update the enable_prune property
with a patch request without modifying the mirror_interval.

## Example request with httpie

### Currently:
**Does nothing**
```bash
http PATCH https://gitea.your-server/api/v1/repos/myOrg/myRepo "enable_prune:=false" -A bearer -a $gitea_token
```

**Updates both properties**
```bash
http PATCH https://gitea.your-server/api/v1/repos/myOrg/myRepo "enable_prune:=false" "mirror_interval=10m" -A bearer -a $gitea_token
```

### With the patch
**Updates enable_prune only**
```bash
http PATCH https://gitea.your-server/api/v1/repos/myOrg/myRepo "enable_prune:=false" -A bearer -a $gitea_token
```

Co-authored-by: Anthony Quéré <47711333+Anthony-Jhoiro@users.noreply.github.com>
(cherry picked from commit d6eb6c90f4)
2024-01-31 14:18:26 +01:00
Giteabot
4e3b046afc
Implement MigrateRepository for the actions notifier (#28920) (#28923)
Backport #28920 by @Zettat123

Fixes #28699

This PR implements the `MigrateRepository` method for `actionsNotifier`
to detect the schedules from the workflow files in the migrated
repository.

Co-authored-by: Zettat123 <zettat123@gmail.com>
(cherry picked from commit 55c53080d1)
2024-01-31 14:18:26 +01:00
Lunny Xiao
8e8adab88c
Upgrade xorm to v1.3.7 to fix a resource leak problem caused by Iterate (#28891) (#28895)
backport #28891

Mainly fix an error https://gitea.com/xorm/xorm/issues/2393

(cherry picked from commit e95006848e)
2024-01-31 14:18:26 +01:00
Jimmy Praet
1c3c6aea47
Don't reload timeline page when (un)resolving or replying conversation (#28654) (#28917)
Backport #28654
Fixes #15981

(cherry picked from commit 9210ce4045)
2024-01-31 14:18:26 +01:00
Giteabot
9f2c7c2b7d
Only migrate the first 255 chars of a Github issue title (#28902) (#28912)
Backport #28902 by @JakobDev

Fixes #28846

Co-authored-by: JakobDev <jakobdev@gmx.de>
(cherry picked from commit cebf55f6b1)
2024-01-31 14:18:26 +01:00
Giteabot
1cb29ff6a2
Fix sort bug on repository issues list (#28897) (#28901)
Backport #28897 by @lunny

Fix #28896

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit b508813fe4)
2024-01-31 14:18:26 +01:00
Giteabot
9a1fb689a4
Fix DeleteCollaboration transaction behaviour (#28886) (#28889)
Backport #28886 by @KN4CK3R

The method can't be called with an outer transaction because if the user
is not a collaborator the outer transaction will be rolled back even if
the inner transaction uses the no-error path.

`has == 0` leads to `return nil` which cancels the transaction. A
standalone call of this method does nothing but if used with an outer
transaction, that will be canceled.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit fd1edb9d9d)
2024-01-31 14:18:26 +01:00
FuXiaoHei
d11597a615
Fix uploaded artifacts should be overwritten (#28726) backport v1.21 (#28832)
Backport https://github.com/go-gitea/gitea/pull/28726 by @fuxiaohei

Fix Uploaded artifacts should be overwritten
https://github.com/go-gitea/gitea/issues/28549

When upload different content to uploaded artifact, it checks that
content size is not match in db record with previous artifact size, then
the new artifact is refused.

Now if it finds uploading content size is not matching db record when
receiving chunks, it updates db records to follow the latest size value.

(cherry picked from commit 7f0ce2dfc7)
2024-01-31 14:18:25 +01:00