summaryrefslogtreecommitdiffstats
path: root/services
Commit message (Collapse)AuthorAgeFilesLines
* Fix get reviewers' bug (#32415) (#32616)Lunny Xiao2024-11-235-56/+168
| | | | | | | | | | This PR rewrites `GetReviewer` function and move it to service layer. Reviewers should not be watchers, so that this PR removed all watchers from reviewers. When the repository is under an organization, the pull request unit read permission will be checked to resolve the bug of Fix #32394 Backport #32415
* Fix debian package clean up (#32351) (#32590)wxiaoguang2024-11-211-4/+5
| | | Partially backport #32351
* allow the actions user to login via the jwt token (#32527) (#32580)Rowan Bohde2024-11-213-3/+86
| | | | | | | | | | | | | | | | | | Backport #32527 We have some actions that leverage the Gitea API that began receiving 401 errors, with a message that the user was not found. These actions use the `ACTIONS_RUNTIME_TOKEN` env var in the actions job to authenticate with the Gitea API. The format of this env var in actions jobs changed with go-gitea/gitea/pull/28885 to be a JWT (with a corresponding update to `act_runner`) Since it was a JWT, the OAuth parsing logic attempted to parse it as an OAuth token, and would return user not found, instead of falling back to look up the running task and assigning it to the actions user. Make ACTIONS_RUNTIME_TOKEN in action runners could be used, attempting to parse Oauth JWTs. The code to parse potential old `ACTION_RUNTIME_TOKEN` was kept in case someone is running an older version of act_runner that doesn't support the Actions JWT.
* Remove unnecessary code (#32560) (#32567)Giteabot2024-11-201-7/+0
| | | | | | | | Backport #32560 by @lunny PushMirrors only be used in the repository setting page. So it should not be loaded on every repository page. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Refactor find forks and fix possible bugs that weak permissions check ↵Lunny Xiao2024-11-191-0/+24
| | | | | | | | | | | | | | | (#32528) (#32547) Backport #32528 - Move models/GetForks to services/FindForks - Add doer as a parameter of FindForks to check permissions - Slight performance optimization for get forks API with batch loading of repository units - Add tests for forking repository to organizations --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor push mirror find and add check for updating push mirror (#32539) ↵Lunny Xiao2024-11-183-12/+11
| | | | | | | | | (#32549) backport #32539 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix basic auth with webauthn (#32531) (#32536)Giteabot2024-11-161-0/+10
| | | | | | | | | Backport #32531 by @lunny WebAuthn should behave the same way as TOTP. When enabled, basic auth with username/password should need to WebAuthn auth, otherwise returned 401. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Remove transaction for archive download (#32186) (#32520)Giteabot2024-11-152-26/+19
| | | | | | | | | | | Backport #32186 by @lunny Since there is a status column in the database, the transaction is unnecessary when downloading an archive. The transaction is blocking database operations, especially with SQLite. Replace #27563 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Trim title before insert/update to database to match the size requirements ↵Lunny Xiao2024-11-141-0/+1
| | | | of database (#32498) (#32507)
* Add a doctor check to disable the "Actions" unit for mirrors (#32424) (#32497)Giteabot2024-11-131-0/+70
| | | | | | | | | | | | Backport #32424 by @Zettat123 Resolve #32232 Users can disable the "Actions" unit for all mirror repos by running ``` gitea doctor check --run disable-mirror-actions-unit --fix ``` Co-authored-by: Zettat123 <zettat123@gmail.com>
* Disable Oauth check if oauth disabled (#32368) (#32480)wxiaoguang2024-11-121-0/+3
| | | Partially backport Disable Oauth check if oauth disabled #32368
* Fix broken releases when re-pushing tags (#32435) (#32449)Giteabot2024-11-101-7/+12
| | | | | | | | | | Backport #32435 by @Zettat123 Fix #32427 --------- Co-authored-by: Zettat123 <zettat123@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Only provide the commit summary for Discord webhook push events (#32432) ↵Giteabot2024-11-083-3/+17
| | | | | | | | | | | | | | | | | | (#32447) Backport #32432 by @kemzeb Resolves #32371. #31970 should have just showed the commit summary, but `strings.SplitN()` was misused such that we did not perform any splitting at all and just used the message. This was not caught in the unit test made in that PR since the test commit summary was > 50 (which truncated away the commit description). This snapshot resolves this and adds another unit test to ensure that we only show the commit summary. Co-authored-by: Kemal Zebari <60799661+kemzeb@users.noreply.github.com>
* Fix `missing signature key` error when pulling Docker images with ↵Zettat1232024-11-012-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `SERVE_DIRECT` enabled (#32365) (#32397) Backport #32365 Fix #28121 I did some tests and found that the `missing signature key` error is caused by an incorrect `Content-Type` header. Gitea correctly sets the `Content-Type` header when serving files. https://github.com/go-gitea/gitea/blob/348d1d0f322ca57c459acd902f54821d687ca804/routers/api/packages/container/container.go#L712-L717 However, when `SERVE_DIRECT` is enabled, the `Content-Type` header may be set to an incorrect value by the storage service. To fix this issue, we can use query parameters to override response header values. https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html <img width="600px" src="https://github.com/user-attachments/assets/f2ff90f0-f1df-46f9-9680-b8120222c555" /> In this PR, I introduced a new parameter to the `URL` method to support additional parameters. ``` URL(path, name string, reqParams url.Values) (*url.URL, error) ```
* Add warn log when deleting inactive users (#32318) (#32321)Lunny Xiao2024-10-231-0/+1
| | | | | Backport #32318 Add log for the problem #31480
* Update scheduled tasks even if changes are pushed by "ActionsUser" (#32246) ↵Zettat1232024-10-141-1/+9
| | | | | | | | | (#32252) Backport #32246 Fix #32219 Co-authored-by: delvh <dev.lh@web.de>
* Only rename a user when they should receive a different name (#32247) (#32249)Giteabot2024-10-131-4/+4
| | | | | | | Backport #32247 by @lunny Fix #31996 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix bug when a token is given public only (#32204) (#32218)Lunny Xiao2024-10-091-3/+4
| | | Backport #32204
* Fix javascript error when an anonymous user visiting migration page (#32144) ↵Lunny Xiao2024-10-041-1/+4
| | | | | | | | | | | | | | (#32179) backport #32144 This PR fixes javascript errors when an anonymous user visits the migration page. It also makes task view checking more restrictive. The router moved from `/user/task/{id}/status` to `/username/reponame/-/migrate/status` because it's a migrate status. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Don't init singing keys if oauth2 provider disabled (#32177)Lunny Xiao2024-10-031-2/+6
| | | Backport #32148
* Fix the logic of finding the latest pull review commit ID (#32139) (#32165)Giteabot2024-10-012-2/+8
| | | | | | | Backport #32139 by @Zettat123 Fix #31423 Co-authored-by: Zettat123 <zettat123@gmail.com>
* Fix bug when deleting a migrated branch (#32075) (#32123)Giteabot2024-09-241-6/+7
| | | | | | | | Backport #32075 by @lunny After migrating a repository with pull request, the branch is missed and after the pull request merged, the branch cannot be deleted. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Truncate commit message during Discord webhook push events (#31970) (#32121)Giteabot2024-09-243-3/+32
| | | | | | | Backport #31970 by @kemzeb Resolves #31668. Co-authored-by: Kemal Zebari <60799661+kemzeb@users.noreply.github.com>
* Fix: database not update release when using `git push --tags --force` ↵Giteabot2024-09-191-8/+10
| | | | | | | | | (#32040) (#32074) Backport #32040 by @ExplodingDragon link: https://codeberg.org/forgejo/forgejo/issues/4274 Co-authored-by: Exploding Dragon <explodingfkl@gmail.com>
* Refactor CSRF protector (#32057) (#32069)wxiaoguang2024-09-182-137/+61
| | | #32057 improves the CSRF handling and is worth to backport
* Add missing comment reply handling (#32050) (#32065)Giteabot2024-09-181-27/+29
| | | | | | | | | | | | | Backport #32050 by @KN4CK3R Fixes #31937 - Add missing comment reply handling - Use `onGiteaRun` in the test because the fixtures are not present otherwise (did this behaviour change?) Compare without whitespaces. Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Handle invalid target when creating releases using API (#31841) (#32043)Giteabot2024-09-171-1/+1
| | | | | | | | | | | Backport #31841 by @kemzeb A 500 status code was thrown when passing a non-existent target to the create release API. This snapshot handles this error and instead throws a 404 status code. Discovered while working on #31840. Co-authored-by: Kemal Zebari <60799661+kemzeb@users.noreply.github.com>
* Do not escape relative path in RPM primary index (#32038) (#32054)Giteabot2024-09-171-2/+1
| | | | | | | | | Backport #32038 by @KN4CK3R Fixes #32021 Do not escape the relative path. Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix `/repos/{owner}/{repo}/pulls/{index}/files` endpoint not populating ↵Giteabot2024-09-121-12/+11
| | | | | | | | | | | | | `previous_filename` (#32017) (#32028) Backport #32017 by @charles-plutohealth --- `status == "rename"` should have read `status == "renamed"`. The typo means that file.PreviousFilename would never be populated, which e.g. breaks usage of the Github Action at https://github.com/dorny/paths-filter. Co-authored-by: charles-plutohealth <143208583+charles-plutohealth@users.noreply.github.com>
* Support allowed hosts for migrations to work with proxy (#32025) (#32026)Giteabot2024-09-113-6/+2
| | | | | | | | | | | Backport #32025 by @wolfogre Fix #32024. Follow #27655. After this PR, all usage of "new dial context" needs to provide a proxy, so I dropped the old `NewDialContext` and renamed `NewDialContextWithProxy` to `NewDialContext`. Co-authored-by: Jason Song <i@wolfogre.com>
* Fix nuget/conan/container packages upload bugs (#31967) (#31982)Giteabot2024-09-052-10/+47
| | | | | Backport #31967 by @lunny Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix 500 error when `state` params is set when editing issue/PR by API ↵Giteabot2024-09-011-0/+3
| | | | | | | | | (#31880) (#31952) Backport #31880 by @yp05327 A quick fix for #31871 Co-authored-by: yp05327 <576951401@qq.com>
* Fix agit automerge (#31207) (#31881)Giteabot2024-08-201-3/+15
| | | | | | | Backport #31207 by @lunny Fix #31134 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix actions notify bug (#31866) (#31875)Giteabot2024-08-202-11/+16
| | | | | | | | Backport #31866 by @lunny Try to fix https://github.com/go-gitea/gitea/issues/31757#issuecomment-2295131062 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fixes for unreachable project issues when transfer repository from ↵Giteabot2024-08-141-0/+17
| | | | | | | | | | | | | | | | | organization (#31770) (#31828) Backport #31770 by @emrebdr When transferring repositories that have issues linked to a project board to another organization, the issues remain associated with the original project board. This causes the columns in the project board to become bugged, making it difficult to move other issues in or out of the affected columns. As a solution, I removed the issue relations since the other organization does not have this project table. Fix for #31538 Co-authored-by: Edip Emre Bodur <emrebdr29@gmail.com> Co-authored-by: Jason Song <i@wolfogre.com>
* Fix protected branch files detection on pre_receive hook (#31778) (#31796)Giteabot2024-08-081-5/+5
| | | | | | | | | | | | | | | | | | | Backport #31778 by @lunny Fix #31738 When pushing a new branch, the old commit is zero. Most git commands cannot recognize the zero commit id. To get the changed files in the push, we need to get the first diverge commit of this branch. In most situations, we could check commits one by one until one commit is contained by another branch. Then we will think that commit is the diverge point. And in a pre-receive hook, this will be more difficult because all commits haven't been merged and they actually stored in a temporary place by git. So we need to bring some envs to let git know the commit exist. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Distinguish LFS object errors to ignore missing objects during migration ↵Giteabot2024-07-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#31702) (#31745) Backport #31702 by @wolfogre Fix #31137. Replace #31623 #31697. When migrating LFS objects, if there's any object that failed (like some objects are losted, which is not really critical), Gitea will stop migrating LFS immediately but treat the migration as successful. This PR checks the error according to the [LFS api doc](https://github.com/git-lfs/git-lfs/blob/main/docs/api/batch.md#successful-responses). > LFS object error codes should match HTTP status codes where possible: > > - 404 - The object does not exist on the server. > - 409 - The specified hash algorithm disagrees with the server's acceptable options. > - 410 - The object was removed by the owner. > - 422 - Validation error. If the error is `404`, it's safe to ignore it and continue migration. Otherwise, stop the migration and mark it as failed to ensure data integrity of LFS objects. And maybe we should also ignore others errors (maybe `410`? I'm not sure what's the difference between "does not exist" and "removed by the owner".), we can add it later when some users report that they have failed to migrate LFS because of an error which should be ignored. Co-authored-by: Jason Song <i@wolfogre.com>
* Add permission check when creating PR (#31033) (#31720)yp053272024-07-291-0/+24
| | | | | Backport #31033 user should be a collaborator of the base repo to create a PR
* Fix a branch divergence cache bug (#31659) (#31661)Giteabot2024-07-192-2/+25
| | | | | | | | | | | | Backport #31659 by @Zettat123 Fix #31599 Fix #31472 A branch divergence is counted based on the default branch. If the default branch is updated, all divergence caches of the repo need to be deleted. Co-authored-by: Zettat123 <zettat123@gmail.com>
* Fix: Allow org team names of length 255 in create team form (#31564) (#31603)Giteabot2024-07-101-1/+1
| | | | | | | | | | | | | | | | | Backport #31564 by @tobiasbp Gitea 1.22.1 was supposed to allow for team names of length 255 (up from 30) after the following PR was merged in: https://github.com/go-gitea/gitea/pull/31410. However, the length of team names was still limited to 30 as described in this issue: https://github.com/go-gitea/gitea/issues/31554. One more change to _gitea_ needs to be made to allow for the longer team names, as there is a 30 character limit here: https://github.com/go-gitea/gitea/blob/2c92c7c5226e29636a1d47a277130f477fa2037b/services/forms/org.go#L65 This PR changes that value to 255. Co-authored-by: Tobias Balle-Petersen <tobias.petersen@unity3d.com>
* Use old behavior for telegram webhook (#31588)wxiaoguang2024-07-092-18/+29
| | | Fix #31182
* Fix slow patch checking with commits that add or remove many files (#31548) ↵Giteabot2024-07-051-8/+21
| | | | | | | | | | | | | | | | | | | (#31560) Backport #31548 by @brechtvl Running git update-index for every individual file is slow, so add and remove everything with a single git command. When such a big commit lands in the default branch, it could cause PR creation and patch checking for all open PRs to be slow, or time out entirely. For example, a commit that removes 1383 files was measured to take more than 60 seconds and timed out. With this change checking took about a second. This is related to #27967, though this will not help with commits that change many lines in few files. Co-authored-by: Brecht Van Lommel <brecht@blender.org>
* [Fix] Account Linking UpdateMigrationsByType (#31428) (#31434)Giteabot2024-06-201-0/+6
| | | | | Backport #31428 by Sumit189 Co-authored-by: Sumit <sumit.18.paul@gmail.com>
* Fix #31185 try fix lfs download from bitbucket failed (#31201) (#31329)Giteabot2024-06-121-1/+1
| | | | | | | Backport #31201 by @Zoupers Fix #31185 Co-authored-by: Zoupers Zou <1171443643@qq.com>
* Fix push multiple branches error with tests (#31151) (#31153)Giteabot2024-05-301-1/+1
| | | | | | | | | | | | | Backport #31151 by @lunny Fix #31140 The previous logic is wrong when pushing multiple branches. After first branch updated, it will ignore left other branches sync operations. As a workaround for the repositories, just push a new commit after the patch applied will fix the repositories status. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix API repository object format missed (#31118) (#31132)Giteabot2024-05-281-0/+1
| | | | | | | Backport #31118 by @lunny Fix #31117 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Make gitea webhooks openproject compatible (#28435) (#31081)Giteabot2024-05-263-23/+44
| | | | | Backport #28435 by Chief-Detektor Co-authored-by: André Rosenhammer <andre.rosenhammer@gmail.com>
* Fix automerge will not work because of some events haven't been triggered ↵Giteabot2024-05-223-39/+117
| | | | | | | | | | | | | | | | | | (#30780) (#31039) Backport #30780 by @lunny Replace #25741 Close #24445 Close #30658 Close #20646 ~Depends on #30805~ Since #25741 has been rewritten totally, to make the contribution easier, I will continue the work in this PR. Thanks @6543 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor sha1 and time-limited code (#31023) (#31030)Giteabot2024-05-211-2/+1
| | | | | Backport #31023 by wxiaoguang Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Return `access_denied` error when an OAuth2 request is denied (#30974) (#31029)Giteabot2024-05-201-0/+1
| | | | | | Backport #30974 by Zettat123 Co-authored-by: Zettat123 <zettat123@gmail.com> Co-authored-by: KN4CK3R <admin@oldschoolhack.me>