Skip to content

Commit 5a83363

Browse files
authored
Merge branch 'main' into fix-15865-spaces-in-webhook-filepath
2 parents 24c65c5 + 8368844 commit 5a83363

File tree

83 files changed

+1253
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+1253
-168
lines changed

cmd/serv.go

+24-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66
package cmd
77

88
import (
9+
"context"
910
"fmt"
1011
"net/http"
1112
"net/url"
1213
"os"
1314
"os/exec"
15+
"os/signal"
1416
"regexp"
1517
"strconv"
1618
"strings"
19+
"syscall"
1720
"time"
1821

1922
"code.gitea.io/gitea/models"
@@ -273,12 +276,31 @@ func runServ(c *cli.Context) error {
273276
verb = strings.Replace(verb, "-", " ", 1)
274277
}
275278

279+
ctx, cancel := context.WithCancel(context.Background())
280+
defer cancel()
281+
go func() {
282+
// install notify
283+
signalChannel := make(chan os.Signal, 1)
284+
285+
signal.Notify(
286+
signalChannel,
287+
syscall.SIGINT,
288+
syscall.SIGTERM,
289+
)
290+
select {
291+
case <-signalChannel:
292+
case <-ctx.Done():
293+
}
294+
cancel()
295+
signal.Reset()
296+
}()
297+
276298
var gitcmd *exec.Cmd
277299
verbs := strings.Split(verb, " ")
278300
if len(verbs) == 2 {
279-
gitcmd = exec.Command(verbs[0], verbs[1], repoPath)
301+
gitcmd = exec.CommandContext(ctx, verbs[0], verbs[1], repoPath)
280302
} else {
281-
gitcmd = exec.Command(verb, repoPath)
303+
gitcmd = exec.CommandContext(ctx, verb, repoPath)
282304
}
283305

284306
gitcmd.Dir = setting.RepoRootPath

custom/conf/app.example.ini

+6-3
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,9 @@ PATH =
573573
;;
574574
;; Respond to pushes to a non-default branch with a URL for creating a Pull Request (if the repository has them enabled)
575575
;PULL_REQUEST_PUSH_MESSAGE = true
576+
;;
577+
;; (Go-Git only) Don't cache objects greater than this in memory. (Set to 0 to disable.)
578+
;LARGE_OBJECT_THRESHOLD = 1048576
576579

577580
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
578581
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1031,13 +1034,13 @@ PATH =
10311034
;;
10321035
;; All available reactions users can choose on issues/prs and comments.
10331036
;; Values can be emoji alias (:smile:) or a unicode emoji.
1034-
;; For custom reactions, add a tightly cropped square image to public/emoji/img/reaction_name.png
1037+
;; For custom reactions, add a tightly cropped square image to public/img/emoji/reaction_name.png
10351038
;REACTIONS = +1, -1, laugh, hooray, confused, heart, rocket, eyes
10361039
;;
10371040
;; Additional Emojis not defined in the utf8 standard
1038-
;; By default we support gitea (:gitea:), to add more copy them to public/emoji/img/emoji_name.png and add it to this config.
1041+
;; By default we support gitea (:gitea:), to add more copy them to public/img/emoji/emoji_name.png and add it to this config.
10391042
;; Dont mistake it for Reactions.
1040-
;CUSTOM_EMOJIS = gitea
1043+
;CUSTOM_EMOJIS = gitea, codeberg, gitlab, git, github, gogs
10411044
;;
10421045
;; Whether the full name of the users should be shown where possible. If the full name isn't set, the username will be used.
10431046
;DEFAULT_SHOW_FULL_NAME = false

docs/config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ params:
1818
description: Git with a cup of tea
1919
author: The Gitea Authors
2020
website: https://docs.gitea.io
21-
version: 1.14.2
21+
version: 1.14.3
2222
minGoVersion: 1.14
2323
goVersion: 1.16
2424
minNodeVersion: 12.17

docs/content/doc/advanced/config-cheat-sheet.en-us.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ The following configuration set `Content-Type: application/vnd.android.package-a
180180
- `MAX_DISPLAY_FILE_SIZE`: **8388608**: Max size of files to be displayed (default is 8MiB)
181181
- `REACTIONS`: All available reactions users can choose on issues/prs and comments
182182
Values can be emoji alias (:smile:) or a unicode emoji.
183-
For custom reactions, add a tightly cropped square image to public/emoji/img/reaction_name.png
184-
- `CUSTOM_EMOJIS`: **gitea**: Additional Emojis not defined in the utf8 standard.
185-
By default we support gitea (:gitea:), to add more copy them to public/emoji/img/emoji_name.png and
183+
For custom reactions, add a tightly cropped square image to public/img/emoji/reaction_name.png
184+
- `CUSTOM_EMOJIS`: **gitea, codeberg, gitlab, git, github, gogs**: Additional Emojis not defined in the utf8 standard.
185+
By default we support gitea (:gitea:), to add more copy them to public/img/emoji/emoji_name.png and
186186
add it to this config.
187187
- `DEFAULT_SHOW_FULL_NAME`: **false**: Whether the full name of the users should be shown where possible. If the full name isn't set, the username will be used.
188188
- `SEARCH_REPO_DESCRIPTION`: **true**: Whether to search within description at repository search on explore page.
@@ -392,7 +392,7 @@ relation to port exhaustion.
392392
- `MAX_ATTEMPTS`: **10**: Maximum number of attempts to create the wrapped queue
393393
- `TIMEOUT`: **GRACEFUL_HAMMER_TIME + 30s**: Timeout the creation of the wrapped queue if it takes longer than this to create.
394394
- Queues by default come with a dynamically scaling worker pool. The following settings configure this:
395-
- `WORKERS`: **0** (v1.14 and before: **1**): Number of initial workers for the queue.
395+
- `WORKERS`: **0** (v1.14 and before: **1**): Number of initial workers for the queue.
396396
- `MAX_WORKERS`: **10**: Maximum number of worker go-routines for the queue.
397397
- `BLOCK_TIMEOUT`: **1s**: If the queue blocks for this time, boost the number of workers - the `BLOCK_TIMEOUT` will then be doubled before boosting again whilst the boost is ongoing.
398398
- `BOOST_TIMEOUT`: **5m**: Boost workers will timeout after this long.
@@ -837,7 +837,7 @@ NB: You must have `DISABLE_ROUTER_LOG` set to `false` for this option to take ef
837837
- `PULL_REQUEST_PUSH_MESSAGE`: **true**: Respond to pushes to a non-default branch with a URL for creating a Pull Request (if the repository has them enabled)
838838
- `VERBOSE_PUSH`: **true**: Print status information about pushes as they are being processed.
839839
- `VERBOSE_PUSH_DELAY`: **5s**: Only print verbose information if push takes longer than this delay.
840-
840+
- `LARGE_OBJECT_THRESHOLD`: **1048576**: (Go-Git only), don't cache objects greater than this in memory. (Set to 0 to disable.)
841841
## Git - Timeout settings (`git.timeout`)
842842
- `DEFAUlT`: **360**: Git operations default timeout seconds.
843843
- `MIGRATE`: **600**: Migrate external repositories timeout seconds.

docs/content/doc/installation/from-binary.en-us.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,17 @@ chmod +x gitea
3232
```
3333

3434
## Verify GPG signature
35-
Gitea signs all binaries with a [GPG key](https://keys.openpgp.org/search?q=teabot%40gitea.io) to prevent against unwanted modification of binaries. To validate the binary, download the signature file which ends in `.asc` for the binary you downloaded and use the gpg command line tool.
35+
Gitea signs all binaries with a [GPG key](https://keys.openpgp.org/search?q=teabot%40gitea.io) to prevent against unwanted modification of binaries.
36+
To validate the binary, download the signature file which ends in `.asc` for the binary you downloaded and use the gpg command line tool.
3637

3738
```sh
3839
gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
3940
gpg --verify gitea-{{< version >}}-linux-amd64.asc gitea-{{< version >}}-linux-amd64
4041
```
4142

43+
Look for the text `Good signature from "Teabot <[email protected]>"` to assert a good binary,
44+
despite warnings like `This key is not certified with a trusted signature!`.
45+
4246
## Recommended server configuration
4347

4448
**NOTE:** Many of the following directories can be configured using [Environment Variables]({{< relref "doc/advanced/environment-variables.en-us.md" >}}) as well!

docs/content/doc/installation/from-package.en-us.md

+1-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
date: "2016-12-01T16:00:00+02:00"
33
title: "Installation from package"
44
slug: "install-from-package"
5-
weight: 10
5+
weight: 20
66
toc: false
77
draft: false
88
menu:
@@ -92,18 +92,6 @@ is in `/usr/local/etc/rc.d/gitea`.
9292

9393
To enable Gitea to run as a service, run `sysrc gitea_enable=YES` and start it with `service gitea start`.
9494

95-
## Cloudron
96-
97-
Gitea is available as a 1-click install on [Cloudron](https://cloudron.io).
98-
Cloudron makes it easy to run apps like Gitea on your server and keep them up-to-date and secure.
99-
100-
[![Install](/cloudron.svg)](https://cloudron.io/button.html?app=io.gitea.cloudronapp)
101-
102-
The Gitea package is maintained [here](https://git.cloudron.io/cloudron/gitea-app).
103-
104-
There is a [demo instance](https://my.demo.cloudron.io) (username: cloudron password: cloudron) where
105-
you can experiment with running Gitea.
106-
10795
## Third-party
10896

10997
Various other third-party packages of Gitea exist.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
date: "2016-12-01T16:00:00+02:00"
3+
title: "Install on Cloud Provider"
4+
slug: "install-on-cloud-provider"
5+
weight: 20
6+
toc: false
7+
draft: false
8+
menu:
9+
sidebar:
10+
parent: "installation"
11+
name: "On cloud provider"
12+
weight: 20
13+
identifier: "install-on-cloud-provider"
14+
---
15+
16+
# Installation on Cloud Provider
17+
18+
**Table of Contents**
19+
20+
{{< toc >}}
21+
22+
## Cloudron
23+
24+
Gitea is available as a 1-click install on [Cloudron](https://cloudron.io).
25+
Cloudron makes it easy to run apps like Gitea on your server and keep them up-to-date and secure.
26+
27+
[![Install](/cloudron.svg)](https://cloudron.io/button.html?app=io.gitea.cloudronapp)
28+
29+
The Gitea package is maintained [here](https://git.cloudron.io/cloudron/gitea-app).
30+
31+
There is a [demo instance](https://my.demo.cloudron.io) (username: cloudron password: cloudron) where
32+
you can experiment with running Gitea.
33+
34+
## Vultr
35+
36+
Gitea can found in [Vultr](https://www.vultr.com)'s marketplace.
37+
38+
To deploy it have a look at https://www.vultr.com/marketplace/apps/gitea.
39+
40+
## DigitalOcean
41+
42+
[DigitalOcean](https://www.digitalocean.com) has gitea as droplet in his marketplace.
43+
44+
Just create a new [Gitea Droplet](https://marketplace.digitalocean.com/apps/gitea).

go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ require (
4141
github.com/go-chi/cors v1.2.0
4242
github.com/go-enry/go-enry/v2 v2.7.0
4343
github.com/go-git/go-billy/v5 v5.3.1
44-
github.com/go-git/go-git/v5 v5.4.2
44+
github.com/go-git/go-git/v5 v5.4.3-0.20210630082519-b4368b2a2ca4
4545
github.com/go-ldap/ldap/v3 v3.3.0
4646
github.com/go-redis/redis/v8 v8.10.0
4747
github.com/go-sql-driver/mysql v1.6.0
@@ -123,9 +123,9 @@ require (
123123
go.uber.org/multierr v1.7.0 // indirect
124124
go.uber.org/zap v1.17.0 // indirect
125125
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e
126-
golang.org/x/net v0.0.0-20210525063256-abc453219eb5
126+
golang.org/x/net v0.0.0-20210614182718-04defd469f4e
127127
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c
128-
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22
128+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c
129129
golang.org/x/text v0.3.6
130130
golang.org/x/time v0.0.0-20210608053304-ed9ce3a009e4 // indirect
131131
golang.org/x/tools v0.1.0

go.sum

+6-5
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Ai
313313
github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
314314
github.com/go-git/go-git-fixtures/v4 v4.2.1 h1:n9gGL1Ct/yIw+nfsfr8s4+sbhT+Ncu2SubfXjIWgci8=
315315
github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0=
316-
github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4=
317-
github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc=
316+
github.com/go-git/go-git/v5 v5.4.3-0.20210630082519-b4368b2a2ca4 h1:1RSUwVK7VjTeA82kcLIqz1EU70QRwFdZUlJW58gP4GY=
317+
github.com/go-git/go-git/v5 v5.4.3-0.20210630082519-b4368b2a2ca4/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc=
318318
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
319319
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
320320
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
@@ -1233,8 +1233,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
12331233
golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k=
12341234
golang.org/x/net v0.0.0-20210331060903-cb1fcc7394e5/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
12351235
golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
1236-
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 h1:wjuX4b5yYQnEQHzd+CBcrcC6OVR2J1CN6mUy0oSxIPo=
1237-
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
1236+
golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q=
1237+
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
12381238
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
12391239
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
12401240
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -1339,8 +1339,9 @@ golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7w
13391339
golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
13401340
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
13411341
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1342-
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio=
13431342
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1343+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
1344+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
13441345
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
13451346
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
13461347
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

integrations/api_pull_commits_test.go

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2021 The Gitea Authors. All rights reserved.
2+
// Use of this source code is governed by a MIT-style
3+
// license that can be found in the LICENSE file.
4+
5+
package integrations
6+
7+
import (
8+
"net/http"
9+
"testing"
10+
11+
"code.gitea.io/gitea/models"
12+
api "code.gitea.io/gitea/modules/structs"
13+
"github.com/stretchr/testify/assert"
14+
)
15+
16+
func TestAPIPullCommits(t *testing.T) {
17+
defer prepareTestEnv(t)()
18+
pullIssue := models.AssertExistsAndLoadBean(t, &models.PullRequest{ID: 2}).(*models.PullRequest)
19+
assert.NoError(t, pullIssue.LoadIssue())
20+
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: pullIssue.HeadRepoID}).(*models.Repository)
21+
22+
session := loginUser(t, "user2")
23+
req := NewRequestf(t, http.MethodGet, "/api/v1/repos/%s/%s/pulls/%d/commits", repo.OwnerName, repo.Name, pullIssue.Index)
24+
resp := session.MakeRequest(t, req, http.StatusOK)
25+
26+
var commits []*api.Commit
27+
DecodeJSON(t, resp, &commits)
28+
29+
if !assert.Len(t, commits, 2) {
30+
return
31+
}
32+
33+
assert.Equal(t, "5f22f7d0d95d614d25a5b68592adb345a4b5c7fd", commits[0].SHA)
34+
assert.Equal(t, "4a357436d925b5c974181ff12a994538ddc5a269", commits[1].SHA)
35+
}
36+
37+
// TODO add tests for already merged PR and closed PR

integrations/download_test.go

+28
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"net/http"
99
"testing"
1010

11+
"code.gitea.io/gitea/modules/setting"
1112
"github.com/stretchr/testify/assert"
1213
)
1314

@@ -62,3 +63,30 @@ func TestDownloadByIDMediaForSVGUsesSecureHeaders(t *testing.T) {
6263
assert.Equal(t, "image/svg+xml", resp.HeaderMap.Get("Content-Type"))
6364
assert.Equal(t, "nosniff", resp.HeaderMap.Get("X-Content-Type-Options"))
6465
}
66+
67+
func TestDownloadRawTextFileWithoutMimeTypeMapping(t *testing.T) {
68+
defer prepareTestEnv(t)()
69+
70+
session := loginUser(t, "user2")
71+
72+
req := NewRequest(t, "GET", "/user2/repo2/raw/branch/master/test.xml")
73+
resp := session.MakeRequest(t, req, http.StatusOK)
74+
75+
assert.Equal(t, "text/plain; charset=utf-8", resp.HeaderMap.Get("Content-Type"))
76+
}
77+
78+
func TestDownloadRawTextFileWithMimeTypeMapping(t *testing.T) {
79+
defer prepareTestEnv(t)()
80+
setting.MimeTypeMap.Map[".xml"] = "text/xml"
81+
setting.MimeTypeMap.Enabled = true
82+
83+
session := loginUser(t, "user2")
84+
85+
req := NewRequest(t, "GET", "/user2/repo2/raw/branch/master/test.xml")
86+
resp := session.MakeRequest(t, req, http.StatusOK)
87+
88+
assert.Equal(t, "text/xml; charset=utf-8", resp.HeaderMap.Get("Content-Type"))
89+
90+
delete(setting.MimeTypeMap.Map, ".xml")
91+
setting.MimeTypeMap.Enabled = false
92+
}

integrations/gitea-repositories-meta/user2/repo2.git/objects/10/32bbf17fbc0d9c95bb5418dabe8f8c99278700

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
x��K
2+
�0Eg� %��":u��􊕦J|������p˭�Q��~%�9ل����G6G� �ͦw(��E4}*���{�)`YƆ�l�e�MJO�ܚ>�����%��^��ݿ�L�!]�N[v#E�6�U~/���0 Z��U'�gpJ5
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
205ac761f3326a7ebe416e8673760016450b5cec
1+
1032bbf17fbc0d9c95bb5418dabe8f8c99278700

models/convert.go

+6
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,16 @@ import (
88
"fmt"
99

1010
"code.gitea.io/gitea/modules/setting"
11+
12+
"xorm.io/xorm/schemas"
1113
)
1214

1315
// ConvertUtf8ToUtf8mb4 converts database and tables from utf8 to utf8mb4 if it's mysql and set ROW_FORMAT=dynamic
1416
func ConvertUtf8ToUtf8mb4() error {
17+
if x.Dialect().URI().DBType != schemas.MYSQL {
18+
return nil
19+
}
20+
1521
_, err := x.Exec(fmt.Sprintf("ALTER DATABASE `%s` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci", setting.Database.Name))
1622
if err != nil {
1723
return err

models/list_options.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (opts *ListOptions) setEnginePagination(e Engine) Engine {
4141
func (opts *ListOptions) GetStartEnd() (start, end int) {
4242
opts.setDefaultValues()
4343
start = (opts.Page - 1) * opts.PageSize
44-
end = start + opts.Page
44+
end = start + opts.PageSize
4545
return
4646
}
4747

models/repo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ func GetRepoInitFile(tp, name string) ([]byte, error) {
10351035

10361036
var (
10371037
reservedRepoNames = []string{".", ".."}
1038-
reservedRepoPatterns = []string{"*.git", "*.wiki"}
1038+
reservedRepoPatterns = []string{"*.git", "*.wiki", "*.rss", "*.atom"}
10391039
)
10401040

10411041
// IsUsableRepoName returns true when repository is usable

models/user.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ var (
814814
"user",
815815
}
816816

817-
reservedUserPatterns = []string{"*.keys", "*.gpg"}
817+
reservedUserPatterns = []string{"*.keys", "*.gpg", "*.rss", "*.atom"}
818818
)
819819

820820
// isUsableName checks if name is reserved or pattern of name is not allowed

0 commit comments

Comments
 (0)