summaryrefslogtreecommitdiffstats
path: root/modules
Commit message (Collapse)AuthorAgeFilesLines
* Render email addresses as such if followed by punctuation (#27987) (#27991)Giteabot2023-11-112-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | Backport #27987 by @yardenshoham Added the following characters to the regular expression for the email: - , - ; - ? - ! Also added a test case. - Fixes #27616 # Before ![image](https://github.com/go-gitea/gitea/assets/20454870/c57eac26-f281-43ef-a51d-9c9a81b63efa) # After ![image](https://github.com/go-gitea/gitea/assets/20454870/fc7d5c08-4350-4af0-a7f0-d1444d2d75af) Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Yarden Shoham <git@yardenshoham.com>
* Unify two factor check (#27915) (#27939)KN4CK3R2023-11-061-27/+0
| | | | | | | | | | Backport of #27915 Fixes #27819 We have support for two factor logins with the normal web login and with basic auth. For basic auth the two factor check was implemented at three different places and you need to know that this check is necessary. This PR moves the check into the basic auth itself.
* Fix package webhook (#27839) (#27854)Giteabot2023-10-311-0/+1
| | | | | | | | Backport #27839 by @lunny Fix #23742 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Revert "fix orphan check for deleted branch (#27310) (#27320)" (#27763)Lunny Xiao2023-10-241-3/+3
| | | | Because branch table is created until 1.21 Fix #27508
* Fix label render containing invalid HTML (#27752) (#27761)Giteabot2023-10-241-1/+1
| | | | | | | | | | | | Backport #27752 by @earl-warren - The label HTML contained a quote that wasn't being closed. Refs: https://codeberg.org/forgejo/forgejo/pulls/1651 (cherry picked from commit e2bc2c9a1fff482c49dbeb3a51e4e1c698bf506c) Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com> Co-authored-by: Gusted <postmaster@gusted.xyz>
* Support allowed hosts for webhook to work with proxy (#27655) (#27674)Giteabot2023-10-181-3/+15
| | | | | | | | | | | | | | | | | | | | | Backport #27655 by @wolfogre When `webhook.PROXY_URL` has been set, the old code will check if the proxy host is in `ALLOWED_HOST_LIST` or reject requests through the proxy. It requires users to add the proxy host to `ALLOWED_HOST_LIST`. However, it actually allows all requests to any port on the host, when the proxy host is probably an internal address. But things may be even worse. `ALLOWED_HOST_LIST` doesn't really work when requests are sent to the allowed proxy, and the proxy could forward them to any hosts. This PR fixes it by: - If the proxy has been set, always allow connectioins to the host and port. - Check `ALLOWED_HOST_LIST` before forwarding. Co-authored-by: Jason Song <i@wolfogre.com>
* Fix git 2.11 error when checking IsEmpty (#27393) (#27396)Giteabot2023-10-021-1/+2
| | | | | | | | | Backport #27393 by @wxiaoguang Fix #27389 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* fix orphan check for deleted branch (#27310) (#27320)Giteabot2023-09-281-3/+3
| | | | | | | | | | | | | Backport #27310 by @earl-warren - Modify the deleted branch orphan check to check for the new table instead. - Regression from 6e19484f4d3bf372212f2da462110a1a8c10cbf2 - Resolves https://codeberg.org/forgejo/forgejo/issues/1522 (cherry picked from commit c1d888686fe445e4edecb9d835c5b3893b574b75) Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com> Co-authored-by: Gusted <postmaster@gusted.xyz>
* Fix PushEvent NullPointerException jenkinsci/github-plugin (#27203) (#27249)Giteabot2023-09-251-0/+1
| | | | | | | Backport #27203 by @Nabapadma-sarker Fixes #27202 Co-authored-by: Nabapadma-sarker <nabapadmacse1991@gmail.com>
* Quote table `release` in sql queries (#27205) (#27219)KN4CK3R2023-09-241-1/+1
| | | | | | | | | Backport of #27205 Fixes #27174 `release` is a reserved keyword in MySql. I can't reproduce the issue on my setup and we have a test for that code but it seems there can be setups where it fails.
* Load reviewer before sending notification (#27063) (#27064)sebastian-sauer2023-09-131-0/+3
| | | | Fixes #27035
* Fix context cache bug & enable context cache for dashabord commits' ↵Lunny Xiao2023-09-133-46/+22
| | | | | | | | | | | | | authors(#26991) (#27017) backport #26991 Unfortunately, when a system setting hasn't been stored in the database, it cannot be cached. Meanwhile, this PR also uses context cache for push email avatar display which should avoid to read user table via email address again and again. According to my local test, this should reduce dashboard elapsed time from 150ms -> 80ms .
* Use secure cookie for HTTPS sites (#26999) (#27013)wxiaoguang2023-09-111-1/+1
| | | | | | | | | | | Backport #26999 If the AppURL(ROOT_URL) is an HTTPS URL, then the COOKIE_SECURE's default value should be true. And, if a user visits an "http" site with "https" AppURL, they won't be able to login, and they should have been warned. The only problem is that the "language" can't be set either in such case, while I think it is not a serious problem, and it could be fixed easily if needed.
* Fix INI parsing for value with trailing slash (#26995) (#27001)Giteabot2023-09-102-2/+20
| | | | | | | Backport #26995 by @wxiaoguang Fix #26977 (a temp fix) Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Avoid double-unescaping of form value (#26853) (#26863)wxiaoguang2023-09-011-21/+4
| | | | | Backport #26853 The old `prepareQueryArg` did double-unescaping of form value.
* check blocklist for emails when adding them to account (#26812) (#26831)Giteabot2023-08-311-0/+25
| | | | | Backport #26812 by @techknowlogick Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add fix incorrect can_create_org_repo for org owner team (#26683) (#26791)Giteabot2023-08-291-0/+61
| | | | | | | | | | | | Backport #26683 by @yp05327 Related to: #8312 #26491 In migration v109, we only added a new column `CanCreateOrgRepo` in Team table, but not initial the value of it. This may cause bug like #26491. Co-authored-by: yp05327 <576951401@qq.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix some slice append usages (#26778) (#26798)Giteabot2023-08-291-1/+1
| | | | | | Backport #26778 by @harryzcy Co-authored-by: Chongyi Zheng <git@zcy.dev> Co-authored-by: delvh <dev.lh@web.de>
* Use docs.gitea.com instead of docs.gitea.io (#26769)Lunny Xiao2023-08-283-8/+8
| | | backport #26739
* Use correct minio error (#26634) (#26639)Giteabot2023-08-211-2/+2
| | | | | | | | | | | | | | | Backport #26634 by @delvh Previously, `err` was defined above, checked for `err == nil` and used nowhere else. Hence, the result of `convertMinioErr` would always be `nil`. This leads to a NPE further down the line. That is not intentional, it should convert the error of the most recent operation, not one of its predecessors. Found through https://discord.com/channels/322538954119184384/322538954119184384/1143185780206993550. Co-authored-by: delvh <dev.lh@web.de>
* Add `branch_filter` to hooks API endpoints (#26599) (#26632)Giteabot2023-08-211-0/+1
| | | | | | | | | | Backport #26599 by @yardenshoham We now include the branch filler in the response. - Closes #26591 Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Yarden Shoham <git@yardenshoham.com>
* Sync repo's IsEmpty status correctly (#26517) (#26560)Giteabot2023-08-171-1/+1
| | | | | | | Backport #26517 by @wxiaoguang Close #26509 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Detect ogg mime-type as audio or video (#26494) (#26505)Giteabot2023-08-152-1/+25
| | | | | | | | | | | | | Backport #26494 by @wxiaoguang "ogg" is just a "container" format for audio and video. Golang's `DetectContentType` only reports "application/ogg" for potential ogg files. Actually it could do more "guess" to see whether it is a audio file or a video file. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix storage path logic especially for relative paths (#26441) (#26481)Giteabot2023-08-132-93/+294
| | | | | | | | | | Backport #26441 by @lunny This PR rewrites the function `getStorage` and make it more clear. Include tests from #26435, thanks @earl-warren Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Earl Warren <contact@earl-warren.org>
* Close stdout correctly for "git blame" (#26470) (#26473)Giteabot2023-08-131-5/+12
| | | | | | | | | | | Backport #26470 by @wxiaoguang Close stdout correctly for "git blame", otherwise the failed "git blame" would cause the request hanging forever. And "os.Stderr" should never (seldom) be used as git command's stderr (there seems some similar problems in code, they could be fixed later). Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Remove last newline from config file (#26468) (#26471)Giteabot2023-08-132-0/+21
| | | | | | | | | | | Backport #26468 by @wxiaoguang When users put the secrets into a file (GITEA__sec__KEY__FILE), the newline sometimes is different to avoid (eg: echo/vim/...) So the last newline could be removed when reading, it makes the users easier to maintain the secret files. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Check first if minio bucket exists before trying to create it (#26420) (#26465)Giteabot2023-08-121-6/+10
| | | | | | | | | | | | Backport #26420 by @lunny For some reason, the permission of the client_id and secret may cannot create bucket, so now we will check whether bucket does exist first and then try to create a bucket if it doesn't exist. Try to fix #25984 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
* minio: add missing region on client initialization (#26412) (#26438)Giteabot2023-08-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #26412 by @nekrondev The MinIO client isn't redirecting to the correct AWS endpoint if a non-default data center is used. In my use case I created an AWS bucket at `eu-central-1` region. Because of the missing region initialization of the client the default `us-east-1` API endpoint is used returning a `301 Moved Permanently` response that's not handled properly by MinIO client. This in return aborts using S3 storage on AWS as the `BucketExists()` call will fail with the http moved error. MinIO client trace shows the issue: ```text ---------START-HTTP--------- HEAD / HTTP/1.1 Host: xxxxxxxxxxx-prod-gitea-data.s3.dualstack.us-east-1.amazonaws.com User-Agent: MinIO (windows; amd64) minio-go/v7.0.61 Authorization: AWS4-HMAC-SHA256 Credential=**REDACTED**/20230809/accesspoint.eu-central-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=**REDACTED** X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 X-Amz-Date: 20230809T141143Z HTTP/1.1 301 Moved Permanently Connection: close Content-Type: application/xml Date: Wed, 09 Aug 2023 14:11:43 GMT Server: AmazonS3 X-Amz-Bucket-Region: eu-central-1 X-Amz-Id-2: UK7wfeYi0HcTcytNvQ3wTAZ5ZP1mOSMnvRZ9Fz4xXzeNsS47NB/KfFx2unFxo3L7XckHpMNPPVo= X-Amz-Request-Id: S1V2MJV8SZ11GEVN ---------END-HTTP--------- ``` Co-authored-by: nekrondev <heiko@noordsee.de> Co-authored-by: Heiko Besemann <heiko.besemann@qbeyond.de>
* Fix admin queue page title and fix CI failures (#26409) (#26421)wxiaoguang2023-08-101-2/+7
| | | | | | Backport #26409 * Fix #26408 * Bypass the data race issue in "ssh" package
* Introduce ctx.PathParamRaw to avoid incorrect unescaping (#26392) (#26405)Giteabot2023-08-091-0/+4
| | | | | | | | | | Backport #26392 by @wxiaoguang Fix #26389 And complete an old TODO: `ctx.Params does un-escaping,..., which is incorrect.` Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix incorrect CLI exit code and duplicate error message (#26346) (#26347)wxiaoguang2023-08-051-0/+6
| | | | | Backport #26346 Follow the CLI refactoring, and add tests.
* Prevent newline errors with Debian packages (#26332) (#26342)Giteabot2023-08-051-10/+11
| | | | | | | Backport #26332 by @KN4CK3R Fixes #26313 Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Make git batch operations use parent context timeout instead of default ↵Giteabot2023-08-041-0/+4
| | | | | | | | | | | | | timeout (#26325) (#26330) Backport #26325 by @wxiaoguang Fix #26064 Some git commands should use parent context, otherwise it would exit too early (by the default timeout, 10m), and the "cmd.Wait" waits till the pipes are closed. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix the wrong derive path (#26271) (#26318)Giteabot2023-08-042-17/+215
| | | | | | | | | | | | | | Backport #26271 by @lunny This PR will fix #26264, caused by #23911. The package configuration derive is totally wrong when storage type is local in that PR. This PR fixed the inherit logic when storage type is local with some unit tests. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Support getting changed files when commit ID is `EmptySHA` (#26290) (#26316)Giteabot2023-08-043-3/+50
| | | | | | | | | | | | | | | | | | | | | Backport #26290 by @Zettat123 Fixes #26270. Co-Author: @wxiaoguang Thanks @lunny for providing this solution As https://github.com/go-gitea/gitea/issues/26270#issuecomment-1661695151 said, at present we cannot get the names of changed files correctly when the `OldCommitID` is `EmptySHA`. In this PR, the `GetCommitFilesChanged` method is added and will be used to get the changed files by commit ID. References: - https://stackoverflow.com/a/424142 Co-authored-by: Zettat123 <zettat123@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Clarify the logger's MODE config option (#26267) (#26281)Giteabot2023-08-021-1/+1
| | | | | | | | | Backport #26267 by @wxiaoguang 1. Fix the wrong document (add the missing `MODE=`) 2. Add a more friendly log message to tell users to add `MODE=` in their config Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix allowed user types setting problem (#26200) (#26206)Giteabot2023-07-292-6/+110
| | | | | | | Backport #26200 by @lunny Fix #25951 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Calculate MAX_WORKERS default value by CPU number (#26177) (#26183)Giteabot2023-07-272-15/+22
|
* Display deprecated warning in admin panel pages as well as in the log file ↵Lunny Xiao2023-07-263-8/+38
| | | | | | | | | | | | | | | (#26094) (#26154) backport #26094 Temporily resolve #25915 Related #25994 This PR includes #26007 's changes but have a UI to prompt administrator about the deprecated settings as well as the log or console warning. Then users will have enough time to notice the problem and don't have surprise like before. <img width="1293" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/c33355f0-1ea7-4fb3-ad43-cd23cd15391d">
* Fix incorrect router logger (#26137) (#26143)Giteabot2023-07-261-3/+3
| | | | | | | | | | Backport #26137 by @wxiaoguang A low-level mistake: * `log.Info` is global `Info` function, which calls "default" logger * `logger.Info` is the for router's logger Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Avoid writing config file if not installed (#26107) (#26113)Giteabot2023-07-251-1/+1
| | | | | | | | Backport #26107 by @wxiaoguang Just like others (oauth2 secret, internal token, etc), do not generate if no install lock Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix handling of Debian files with trailing slash (#26087) (#26098)Giteabot2023-07-242-49/+65
| | | | | | | | | | | Backport #26087 by @KN4CK3R Fixes #26022 - Fix handling of files with trailing slash - Fix handling of duplicate package file errors - Added test for both Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Use stderr as fallback if the log file can't be opened (#26074) (#26083)Giteabot2023-07-241-1/+6
| | | | | | | | Backport #26074 by @wxiaoguang If the log file can't be opened, what should it do? panic/exit? ignore logs? fallback to stderr? It seems that "fallback to stderr" is slightly better than others ....
* Adding remaining enum for migration repo model type. (#26021) (#26034)Giteabot2023-07-211-1/+1
| | | | | | | | | Backport #26021 by @puni9869 Fixes: https://github.com/go-gitea/gitea/issues/26010 Adding remaining enum for migration repo model type. Co-authored-by: puni9869 <80308335+puni9869@users.noreply.github.com>
* Fix env config parsing for "GITEA____APP_NAME" (#26001) (#26013)Giteabot2023-07-202-1/+7
| | | | | | | | | Backport #26001 by @wxiaoguang Regression of #24832 Fix the bug and add a test for it Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Update path related documents (#25417) (#25982)Giteabot2023-07-191-1/+1
| | | | | | | | | | | | | | Backport #25417 by @wxiaoguang Update WorkPath/WORK_PATH related documents, remove out-dated information. Remove "StaticRootPath" on the admin config display page, because few end user really need it, it only causes misconfiguration. ![image](https://github.com/go-gitea/gitea/assets/2114189/8095afa4-da76-436b-9e89-2a92c229c01d) Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Avoid creating directories when loading config (#25944) (#25957)wxiaoguang2023-07-181-2/+4
| | | | | | | | | | | | Backport #25944 The "creating dir/file during load config" is a longstanding and complex problem. This PR only does a quick patch, it still needs more refactorings in the future. Fix #25938
* Disallow dangerous URL schemes (#25960) (#25964)KN4CK3R2023-07-182-2/+16
| | | | | | | | | | | | Regression: https://github.com/go-gitea/gitea/pull/24805 Closes: #25945 - Disallow `javascript`, `vbscript` and `data` (data uri images still work) url schemes even if all other schemes are allowed - Fixed older `cbthunderlink` tests --------- Co-authored-by: delvh <dev.lh@web.de>
* Skip unuseful error message in dev mode when watching local filesystem ↵Giteabot2023-07-171-1/+1
| | | | | | | | | | | | | | | | | | (#25919) (#25927) Backport #25919 by @wxiaoguang Before, in dev mode, there might be some error logs like: ``` 2023/07/17 13:54:51 ...s/assetfs/layered.go:221:WatchLocalChanges() [E] Unable to watch directory .: lstat /data/work/gitea/custom/templates: no such file or directory ``` Because there is no "custom/templates" directory. After: ignore such error, no such error message anymore. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add shutting down notice (#25920) (#25922)Giteabot2023-07-171-1/+1
| | | | | | | | | | | Backport #25920 by @KN4CK3R Got the same problem as #25915 when updating an instance. The `log.Fatal` should have been marked as breaking in #23911. This PR adds a notice that the system is shutting down because of the deprecated setting. Co-authored-by: KN4CK3R <admin@oldschoolhack.me>