diff --git a/Dockerfile.rootless b/Dockerfile.rootless index 70f6540112d4..efdb3bb72889 100644 --- a/Dockerfile.rootless +++ b/Dockerfile.rootless @@ -56,7 +56,7 @@ COPY docker/rootless / COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/gitea /usr/local/bin/gitea COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini -USER git:git +USER 1000:1000 # git:git ENV GITEA_WORK_DIR /var/lib/gitea ENV GITEA_CUSTOM /var/lib/gitea/custom ENV GITEA_TEMP /tmp/gitea diff --git a/Makefile b/Makefile index 1fd4216dac85..c07dfbf47563 100644 --- a/Makefile +++ b/Makefile @@ -297,7 +297,7 @@ misspell-check: GO111MODULE=off $(GO) get -u github.com/client9/misspell/cmd/misspell; \ fi @echo "Running misspell-check..." - @misspell -error -i unknwon,destory $(GO_SOURCES_OWN) + @misspell -error -i unknwon $(GO_SOURCES_OWN) .PHONY: misspell misspell: diff --git a/cmd/dump.go b/cmd/dump.go index 458f9f91e017..629993b6c80b 100644 --- a/cmd/dump.go +++ b/cmd/dump.go @@ -280,7 +280,7 @@ func runDump(ctx *cli.Context) error { } if ctx.IsSet("skip-custom-dir") && ctx.Bool("skip-custom-dir") { - log.Info("Skiping custom directory") + log.Info("Skipping custom directory") } else { customDir, err := os.Stat(setting.CustomPath) if err == nil && customDir.IsDir() { diff --git a/cmd/hook.go b/cmd/hook.go index 2fbbfb4d21ae..067a0bfb8ab9 100644 --- a/cmd/hook.go +++ b/cmd/hook.go @@ -165,7 +165,7 @@ Gitea or set your environment appropriately.`, "") } } - // the environment setted on serv command + // the environment is set by serv command isWiki := os.Getenv(models.EnvRepoIsWiki) == "true" username := os.Getenv(models.EnvRepoUsername) reponame := os.Getenv(models.EnvRepoName) @@ -320,7 +320,7 @@ Gitea or set your environment appropriately.`, "") } } - // the environment setted on serv command + // the environment is set by serv command repoUser := os.Getenv(models.EnvRepoUsername) isWiki := os.Getenv(models.EnvRepoIsWiki) == "true" repoName := os.Getenv(models.EnvRepoName) diff --git a/cmd/migrate_storage.go b/cmd/migrate_storage.go index 8ff84d690b9a..8123716f9ba9 100644 --- a/cmd/migrate_storage.go +++ b/cmd/migrate_storage.go @@ -184,7 +184,7 @@ func runMigrateStorage(ctx *cli.Context) error { return fmt.Errorf("Unsupported storage: %s", ctx.String("type")) } - log.Warn("All files have been copied to the new placement but old files are still on the orignial placement.") + log.Warn("All files have been copied to the new placement but old files are still on the original placement.") return nil } diff --git a/cmd/web_letsencrypt.go b/cmd/web_letsencrypt.go index 68ffca729c41..a68399979035 100644 --- a/cmd/web_letsencrypt.go +++ b/cmd/web_letsencrypt.go @@ -19,7 +19,7 @@ import ( func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler) error { // If HTTP Challenge enabled, needs to be serving on port 80. For TLSALPN needs 443. - // Due to docker port mapping this can't be checked programatically + // Due to docker port mapping this can't be checked programmatically // TODO: these are placeholders until we add options for each in settings with appropriate warning enableHTTPChallenge := true enableTLSALPNChallenge := true diff --git a/contrib/update_dependencies.sh b/contrib/update_dependencies.sh old mode 100644 new mode 100755 diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index ff21613586b5..22244545f589 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -659,7 +659,7 @@ PATH = ;; Public is for users visible for everyone ;DEFAULT_USER_VISIBILITY = public ;; -;; Set whitch visibibilty modes a user can have +;; Set which visibility modes a user can have ;ALLOWED_USER_VISIBILITY_MODES = public,limited,private ;; ;; Either "public", "limited" or "private", default is "public" diff --git a/docker/root/etc/s6/gitea/setup b/docker/root/etc/s6/gitea/setup index 38187b29e051..d8f6a3b319ee 100755 --- a/docker/root/etc/s6/gitea/setup +++ b/docker/root/etc/s6/gitea/setup @@ -23,7 +23,7 @@ if [ ! -f ${GITEA_CUSTOM}/conf/app.ini ]; then INSTALL_LOCK=true fi - # Substitude the environment variables in the template + # Substitute the environment variables in the template APP_NAME=${APP_NAME:-"Gitea: Git with a cup of tea"} \ RUN_MODE=${RUN_MODE:-"prod"} \ DOMAIN=${DOMAIN:-"localhost"} \ diff --git a/docker/rootless/usr/local/bin/docker-setup.sh b/docker/rootless/usr/local/bin/docker-setup.sh index ef86d01c9f30..47645726c4b0 100755 --- a/docker/rootless/usr/local/bin/docker-setup.sh +++ b/docker/rootless/usr/local/bin/docker-setup.sh @@ -25,7 +25,7 @@ if [ ! -f ${GITEA_APP_INI} ]; then INSTALL_LOCK=true fi - # Substitude the environment variables in the template + # Substitute the environment variables in the template APP_NAME=${APP_NAME:-"Gitea: Git with a cup of tea"} \ RUN_MODE=${RUN_MODE:-"prod"} \ RUN_USER=${USER:-"git"} \ diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 67b375481608..741c5f292cdf 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -128,8 +128,8 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`. - Options other than `never` and `always` can be combined as a comma separated list. - `DEFAULT_TRUST_MODEL`: **collaborator**: \[collaborator, committer, collaboratorcommitter\]: The default trust model used for verifying commits. - `collaborator`: Trust signatures signed by keys of collaborators. - - `committer`: Trust signatures that match committers (This matches GitHub and will force Gitea signed commits to have Gitea as the commmitter). - - `collaboratorcommitter`: Trust signatures signed by keys of collaborators which match the commiter. + - `committer`: Trust signatures that match committers (This matches GitHub and will force Gitea signed commits to have Gitea as the committer). + - `collaboratorcommitter`: Trust signatures signed by keys of collaborators which match the committer. - `WIKI`: **never**: \[never, pubkey, twofa, always, parentsigned\]: Sign commits to wiki. - `CRUD_ACTIONS`: **pubkey, twofa, parentsigned**: \[never, pubkey, twofa, parentsigned, always\]: Sign CRUD actions. - Options as above, with the addition of: @@ -345,9 +345,9 @@ The following configuration set `Content-Type: application/vnd.android.package-a - `PATH`: **data/gitea.db**: For SQLite3 only, the database file path. - `LOG_SQL`: **true**: Log the executed SQL. - `DB_RETRIES`: **10**: How many ORM init / DB connect attempts allowed. -- `DB_RETRY_BACKOFF`: **3s**: time.Duration to wait before trying another ORM init / DB connect attempt, if failure occured. +- `DB_RETRY_BACKOFF`: **3s**: time.Duration to wait before trying another ORM init / DB connect attempt, if failure occurred. - `MAX_OPEN_CONNS` **0**: Database maximum open connections - default is 0, meaning there is no limit. -- `MAX_IDLE_CONNS` **2**: Max idle database connections on connnection pool, default is 2 - this will be capped to `MAX_OPEN_CONNS`. +- `MAX_IDLE_CONNS` **2**: Max idle database connections on connection pool, default is 2 - this will be capped to `MAX_OPEN_CONNS`. - `CONN_MAX_LIFETIME` **0 or 3s**: Sets the maximum amount of time a DB connection may be reused - default is 0, meaning there is no limit (except on MySQL where it is 3s - see #6804 & #7071). Please see #8540 & #8273 for further discussion of the appropriate values for `MAX_OPEN_CONNS`, `MAX_IDLE_CONNS` & `CONN_MAX_LIFETIME` and their @@ -385,7 +385,7 @@ relation to port exhaustion. - `LENGTH`: **20**: Maximal queue size before channel queues block - `BATCH_LENGTH`: **20**: Batch data before passing to the handler - `CONN_STR`: **redis://127.0.0.1:6379/0**: Connection string for the redis queue type. Options can be set using query params. Similarly LevelDB options can also be set using: **leveldb://relative/path?option=value** or **leveldb:///absolute/path?option=value**, and will override `DATADIR` -- `QUEUE_NAME`: **_queue**: The suffix for default redis and disk queue name. Individual queues will default to **`name`**`QUEUE_NAME` but can be overriden in the specific `queue.name` section. +- `QUEUE_NAME`: **_queue**: The suffix for default redis and disk queue name. Individual queues will default to **`name`**`QUEUE_NAME` but can be overridden in the specific `queue.name` section. - `SET_NAME`: **_unique**: The suffix that will be added to the default redis and disk queue `set` name for unique queues. Individual queues will default to **`name`**`QUEUE_NAME`_`SET_NAME`_ but can be overridden in the specific `queue.name` section. - `WRAP_IF_NECESSARY`: **true**: Will wrap queues with a timeoutable queue if the selected queue is not ready to be created - (Only relevant for the level queue.) @@ -516,7 +516,7 @@ relation to port exhaustion. - `AUTO_WATCH_NEW_REPOS`: **true**: Enable this to let all organisation users watch new repos when they are created - `AUTO_WATCH_ON_CHANGES`: **false**: Enable this to make users watch a repository after their first commit to it - `DEFAULT_USER_VISIBILITY`: **public**: Set default visibility mode for users, either "public", "limited" or "private". -- `ALLOWED_USER_VISIBILITY_MODES`: **public,limited,private**: Set whitch visibibilty modes a user can have +- `ALLOWED_USER_VISIBILITY_MODES`: **public,limited,private**: Set which visibility modes a user can have - `DEFAULT_ORG_VISIBILITY`: **public**: Set default visibility mode for organisations, either "public", "limited" or "private". - `DEFAULT_ORG_MEMBER_VISIBLE`: **false** True will make the membership of the users visible when added to the organisation. - `ALLOW_ONLY_INTERNAL_REGISTRATION`: **false** Set to true to force registration only via gitea. @@ -895,7 +895,7 @@ IS_INPUT_FILE = false - ENABLED: **false** Enable markup support; set to **true** to enable this renderer. - NEED\_POSTPROCESS: **true** set to **true** to replace links / sha1 and etc. - FILE\_EXTENSIONS: **\** List of file extensions that should be rendered by an external - command. Multiple extentions needs a comma as splitter. + command. Multiple extensions needs a comma as splitter. - RENDER\_COMMAND: External command to render all matching extensions. - IS\_INPUT\_FILE: **false** Input is not a standard input but a file param followed `RENDER_COMMAND`. @@ -927,7 +927,7 @@ If the rule is defined above the renderer ini section or the name does not match ## Time (`time`) -- `FORMAT`: Time format to diplay on UI. i.e. RFC1123 or 2006-01-02 15:04:05 +- `FORMAT`: Time format to display on UI. i.e. RFC1123 or 2006-01-02 15:04:05 - `DEFAULT_UI_LOCATION`: Default location of time on the UI, so that we can display correct user's time on UI. i.e. Shanghai/Asia ## Task (`task`) diff --git a/docs/content/doc/advanced/logging-documentation.en-us.md b/docs/content/doc/advanced/logging-documentation.en-us.md index 28c87a6ec09c..478b6418c6cb 100644 --- a/docs/content/doc/advanced/logging-documentation.en-us.md +++ b/docs/content/doc/advanced/logging-documentation.en-us.md @@ -282,7 +282,7 @@ ROUTER = console COLORIZE = false ; this can be true if you can strip out the ansi coloring ``` -Sometimes it will be helpful get some specific `TRACE` level logging retricted +Sometimes it will be helpful get some specific `TRACE` level logging restricted to messages that match a specific `EXPRESSION`. Adjusting the `MODE` in the `[log]` section to `MODE = console,traceconsole` to add a new logger output `traceconsole` and then adding its corresponding section would be helpful: diff --git a/docs/content/doc/advanced/protected-tags.en-us.md b/docs/content/doc/advanced/protected-tags.en-us.md index 36e6e169753c..4d109c227833 100644 --- a/docs/content/doc/advanced/protected-tags.en-us.md +++ b/docs/content/doc/advanced/protected-tags.en-us.md @@ -27,7 +27,7 @@ To protect a tag, you need to follow these steps: 1. Go to the repository’s **Settings** > **Tags** page. 1. Type a pattern to match a name. You can use a single name, a [glob pattern](https://pkg.go.dev/github.com/gobwas/glob#Compile) or a regular expression. -1. Choose the allowed users and/or teams. If you leave these fields empty noone is allowed to create or modify this tag. +1. Choose the allowed users and/or teams. If you leave these fields empty no one is allowed to create or modify this tag. 1. Select **Save** to save the configuration. ## Pattern protected tags diff --git a/docs/content/doc/features/authentication.en-us.md b/docs/content/doc/features/authentication.en-us.md index 223d7aa4fb0c..21181ac1b20e 100644 --- a/docs/content/doc/features/authentication.en-us.md +++ b/docs/content/doc/features/authentication.en-us.md @@ -259,7 +259,7 @@ Before activating SSPI single sign-on authentication (SSO) you have to prepare y - Create a service principal name for the host where `gitea.exe` is running with class `HTTP`: - - Start `Command Prompt` or `PowerShell` as a priviledged domain user (eg. Domain Administrator) + - Start `Command Prompt` or `PowerShell` as a privileged domain user (eg. Domain Administrator) - Run the command below, replacing `host.domain.local` with the fully qualified domain name (FQDN) of the server where the web application will be running, and `domain\user` with the name of the account created in the previous step: ```sh @@ -283,7 +283,7 @@ Before activating SSPI single sign-on authentication (SSO) you have to prepare y - Click the `Sign In` button on the dashboard and choose SSPI to be automatically logged in with the same user that is currently logged on to the computer - If it does not work, make sure that: - - You are not running the web browser on the same server where gitea is running. You should be running the web browser on a domain joined computer (client) that is different from the server. If both the client and server are runnning on the same computer NTLM will be prefered over Kerberos. + - You are not running the web browser on the same server where gitea is running. You should be running the web browser on a domain joined computer (client) that is different from the server. If both the client and server are running on the same computer NTLM will be preferred over Kerberos. - There is only one `HTTP/...` SPN for the host - The SPN contains only the hostname, without the port - You have added the URL of the web app to the `Local intranet zone` diff --git a/docs/content/doc/help/faq.en-us.md b/docs/content/doc/help/faq.en-us.md index 1ae881d52d63..ff233d31e36c 100644 --- a/docs/content/doc/help/faq.en-us.md +++ b/docs/content/doc/help/faq.en-us.md @@ -142,7 +142,7 @@ The current way to achieve this is to create/modify a user with a max repo creat Restricted users are limited to a subset of the content based on their organization/team memberships and collaborations, ignoring the public flag on organizations/repos etc.\_\_ -Example use case: A company runs a Gitea instance that requires login. Most repos are public (accessible/browseable by all co-workers). +Example use case: A company runs a Gitea instance that requires login. Most repos are public (accessible/browsable by all co-workers). At some point, a customer or third party needs access to a specific repo and only that repo. Making such a customer account restricted and granting any needed access using team membership(s) and/or collaboration(s) is a simple way to achieve that without the need to make everything private. diff --git a/docs/content/page/index.en-us.md b/docs/content/page/index.en-us.md index 98d61576f3d1..a5204e17dff7 100644 --- a/docs/content/page/index.en-us.md +++ b/docs/content/page/index.en-us.md @@ -117,7 +117,7 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others. - Configuration viewer - Everything in config file - System notices - - When somthing unexpected happens + - When something unexpected happens - Monitoring - Current processes - Cron jobs @@ -155,7 +155,7 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others. - Libravatar - Custom - Password - - Mutiple email addresses + - Multiple email addresses - SSH Keys - Connected applications - Two factor authentication diff --git a/go.mod b/go.mod index 0b773b3c65d5..5032acce990f 100644 --- a/go.mod +++ b/go.mod @@ -80,7 +80,7 @@ require ( github.com/mattn/go-runewidth v0.0.13 // indirect github.com/mattn/go-sqlite3 v1.14.7 github.com/mholt/archiver/v3 v3.5.0 - github.com/microcosm-cc/bluemonday v1.0.14 + github.com/microcosm-cc/bluemonday v1.0.15 github.com/miekg/dns v1.1.43 // indirect github.com/minio/md5-simd v1.1.2 // indirect github.com/minio/minio-go/v7 v7.0.12 diff --git a/go.sum b/go.sum index dcdba019d4ce..fc6e2422c849 100644 --- a/go.sum +++ b/go.sum @@ -795,8 +795,8 @@ github.com/mholt/acmez v0.1.3 h1:J7MmNIk4Qf9b8mAGqAh4XkNeowv3f1zW816yf4zt7Qk= github.com/mholt/acmez v0.1.3/go.mod h1:8qnn8QA/Ewx8E3ZSsmscqsIjhhpxuy9vqdgbX2ceceM= github.com/mholt/archiver/v3 v3.5.0 h1:nE8gZIrw66cu4osS/U7UW7YDuGMHssxKutU8IfWxwWE= github.com/mholt/archiver/v3 v3.5.0/go.mod h1:qqTTPUK/HZPFgFQ/TJ3BzvTpF/dPtFVJXdQbCmeMxwc= -github.com/microcosm-cc/bluemonday v1.0.14 h1:Djd+GeTanVeA23todvVC0AO5hsI+vAwQMLTy794Zr5I= -github.com/microcosm-cc/bluemonday v1.0.14/go.mod h1:beubO5lmWoy1tU8niaMyXNriNgROO37H3U/tsrcZsy0= +github.com/microcosm-cc/bluemonday v1.0.15 h1:J4uN+qPng9rvkBZBoBb8YGR+ijuklIMpSOZZLjYpbeY= +github.com/microcosm-cc/bluemonday v1.0.15/go.mod h1:ZLvAzeakRwrGnzQEvstVzVt3ZpqOF2+sdFr0Om+ce30= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.42/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg= @@ -1235,7 +1235,6 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20210331060903-cb1fcc7394e5/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= diff --git a/integrations/README.md b/integrations/README.md index ccb55377f56e..0b91a7d254a1 100644 --- a/integrations/README.md +++ b/integrations/README.md @@ -28,7 +28,7 @@ make test-sqlite Setup a mysql database inside docker ``` docker run -e "MYSQL_DATABASE=test" -e "MYSQL_ALLOW_EMPTY_PASSWORD=yes" -p 3306:3306 --rm --name mysql mysql:latest #(just ctrl-c to stop db and clean the container) -docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" --rm --name elasticsearch elasticsearch:7.6.0 #(in a secound terminal, just ctrl-c to stop db and clean the container) +docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" --rm --name elasticsearch elasticsearch:7.6.0 #(in a second terminal, just ctrl-c to stop db and clean the container) ``` Start tests based on the database container ``` diff --git a/integrations/api_repo_lfs_test.go b/integrations/api_repo_lfs_test.go index d0328fd12110..9e1e2b041894 100644 --- a/integrations/api_repo_lfs_test.go +++ b/integrations/api_repo_lfs_test.go @@ -135,7 +135,7 @@ func TestAPILFSBatch(t *testing.T) { assert.Equal(t, "Oid or size are invalid", br.Objects[1].Error.Message) }) - t.Run("PointerSizeMissmatch", func(t *testing.T) { + t.Run("PointerSizeMismatch", func(t *testing.T) { defer PrintCurrentTest(t)() req := newRequest(t, &lfs.BatchRequest{ @@ -376,7 +376,7 @@ func TestAPILFSUpload(t *testing.T) { session.MakeRequest(t, req, http.StatusOK) }) - t.Run("HashMissmatch", func(t *testing.T) { + t.Run("HashMismatch", func(t *testing.T) { defer PrintCurrentTest(t)() req := newRequest(t, lfs.Pointer{Oid: "2581dd7bbc1fe44726de4b7dd806a087a978b9c5aec0a60481259e34be09b06a", Size: 1}, "a") @@ -384,7 +384,7 @@ func TestAPILFSUpload(t *testing.T) { session.MakeRequest(t, req, http.StatusUnprocessableEntity) }) - t.Run("SizeMissmatch", func(t *testing.T) { + t.Run("SizeMismatch", func(t *testing.T) { defer PrintCurrentTest(t)() req := newRequest(t, lfs.Pointer{Oid: "ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb", Size: 2}, "a") diff --git a/integrations/release_test.go b/integrations/release_test.go index ac5df315d597..4458387ef75d 100644 --- a/integrations/release_test.go +++ b/integrations/release_test.go @@ -116,7 +116,7 @@ func TestCreateReleasePaging(t *testing.T) { setting.API.DefaultPagingNum = 10 session := loginUser(t, "user2") - // Create enaugh releases to have paging + // Create enough releases to have paging for i := 0; i < 12; i++ { version := fmt.Sprintf("v0.0.%d", i) createNewRelease(t, session, "/user2/repo1", version, version, false, false) diff --git a/integrations/repo_branch_test.go b/integrations/repo_branch_test.go index de4e66898797..af5c475ea7dc 100644 --- a/integrations/repo_branch_test.go +++ b/integrations/repo_branch_test.go @@ -11,6 +11,7 @@ import ( "strings" "testing" + "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/test" "github.com/stretchr/testify/assert" @@ -134,5 +135,13 @@ func TestCreateBranchInvalidCSRF(t *testing.T) { "_csrf": "fake_csrf", "new_branch_name": "test", }) - session.MakeRequest(t, req, http.StatusBadRequest) + resp := session.MakeRequest(t, req, http.StatusFound) + loc := resp.Header().Get("Location") + assert.Equal(t, setting.AppSubURL+"/", loc) + resp = session.MakeRequest(t, NewRequest(t, "GET", loc), http.StatusOK) + htmlDoc := NewHTMLParser(t, resp.Body) + assert.Equal(t, + "Bad Request: Invalid CSRF token", + strings.TrimSpace(htmlDoc.doc.Find(".ui.message").Text()), + ) } diff --git a/models/branches.go b/models/branches.go index d346f195787b..e13d84ee0524 100644 --- a/models/branches.go +++ b/models/branches.go @@ -219,7 +219,7 @@ func (protectBranch *ProtectedBranch) GetProtectedFilePatterns() []glob.Glob { expr = strings.TrimSpace(expr) if expr != "" { if g, err := glob.Compile(expr, '.', '/'); err != nil { - log.Info("Invalid glob expresion '%s' (skipped): %v", expr, err) + log.Info("Invalid glob expression '%s' (skipped): %v", expr, err) } else { extarr = append(extarr, g) } diff --git a/models/context.go b/models/context.go index 4fbd3b6699ee..1221ab7dede9 100644 --- a/models/context.go +++ b/models/context.go @@ -42,7 +42,7 @@ func WithContext(f func(ctx DBContext) error) error { return f(DBContext{x}) } -// WithTx represents executing database operations on a trasaction +// WithTx represents executing database operations on a transaction func WithTx(f func(ctx DBContext) error) error { sess := x.NewSession() if err := sess.Begin(); err != nil { diff --git a/models/error.go b/models/error.go index 513effdb0293..7b99dc65920a 100644 --- a/models/error.go +++ b/models/error.go @@ -1114,7 +1114,7 @@ func IsErrUserDoesNotHaveAccessToRepo(err error) bool { } func (err ErrUserDoesNotHaveAccessToRepo) Error() string { - return fmt.Sprintf("user doesn't have acces to repo [user_id: %d, repo_name: %s]", err.UserID, err.RepoName) + return fmt.Sprintf("user doesn't have access to repo [user_id: %d, repo_name: %s]", err.UserID, err.RepoName) } // ErrWontSign explains the first reason why a commit would not be signed @@ -1289,7 +1289,7 @@ func IsErrSHAOrCommitIDNotProvided(err error) bool { } func (err ErrSHAOrCommitIDNotProvided) Error() string { - return "a SHA or commmit ID must be proved when updating a file" + return "a SHA or commit ID must be proved when updating a file" } // __ __ ___. .__ __ diff --git a/models/gpg_key.go b/models/gpg_key.go index 9530eacb0a70..140a71df6d24 100644 --- a/models/gpg_key.go +++ b/models/gpg_key.go @@ -622,7 +622,7 @@ func ParseCommitWithSignature(c *git.Commit) *CommitVerification { var err error // Find Committer account committer, err = GetUserByEmail(c.Committer.Email) // This finds the user by primary email or activated email so commit will not be valid if email is not - if err != nil { // Skipping not user for commiter + if err != nil { // Skipping not user for committer committer = &User{ Name: c.Committer.Name, Email: c.Committer.Email, @@ -698,7 +698,7 @@ func ParseCommitWithSignature(c *git.Commit) *CommitVerification { } for _, k := range keys { - // Pre-check (& optimization) that emails attached to key can be attached to the commiter email and can validate + // Pre-check (& optimization) that emails attached to key can be attached to the committer email and can validate canValidate := false email := "" for _, e := range k.Emails { diff --git a/models/issue_comment.go b/models/issue_comment.go index 1b98b248b1fc..4c5b77ff8e55 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -184,7 +184,7 @@ type Comment struct { RefRepoID int64 `xorm:"index"` // Repo where the referencing RefIssueID int64 `xorm:"index"` RefCommentID int64 `xorm:"index"` // 0 if origin is Issue title or content (or PR's) - RefAction references.XRefAction `xorm:"SMALLINT"` // What hapens if RefIssueID resolves + RefAction references.XRefAction `xorm:"SMALLINT"` // What happens if RefIssueID resolves RefIsPull bool RefRepo *Repository `xorm:"-"` @@ -1228,7 +1228,7 @@ func UpdateCommentsMigrationsByType(tp structs.GitServiceType, originalAuthorID return err } -// CreatePushPullComment create push code to pull base commend +// CreatePushPullComment create push code to pull base comment func CreatePushPullComment(pusher *User, pr *PullRequest, oldCommitID, newCommitID string) (comment *Comment, err error) { if pr.HasMerged || oldCommitID == "" || newCommitID == "" { return nil, nil @@ -1262,7 +1262,7 @@ func CreatePushPullComment(pusher *User, pr *PullRequest, oldCommitID, newCommit return } -// getCommitsFromRepo get commit IDs from repo in betwern oldCommitID and newCommitID +// getCommitsFromRepo get commit IDs from repo in between oldCommitID and newCommitID // isForcePush will be true if oldCommit isn't on the branch // Commit on baseBranch will skip func getCommitIDsFromRepo(repo *Repository, oldCommitID, newCommitID, baseBranch string) (commitIDs []string, isForcePush bool, err error) { diff --git a/models/issue_dependency.go b/models/issue_dependency.go index 6ecaf3432f89..4008008f3474 100644 --- a/models/issue_dependency.go +++ b/models/issue_dependency.go @@ -128,7 +128,7 @@ func issueNoDependenciesLeft(e Engine, issue *Issue) (bool, error) { return !exists, err } -// IsDependenciesEnabled returns if dependecies are enabled and returns the default setting if not set. +// IsDependenciesEnabled returns if dependencies are enabled and returns the default setting if not set. func (repo *Repository) IsDependenciesEnabled() bool { return repo.isDependenciesEnabled(x) } diff --git a/models/issue_label_test.go b/models/issue_label_test.go index fc6590e96859..3dde1a40696a 100644 --- a/models/issue_label_test.go +++ b/models/issue_label_test.go @@ -135,7 +135,7 @@ func TestGetLabelsByRepoID(t *testing.T) { testSuccess(1, "default", []int64{1, 2}) } -// Org vrsions +// Org versions func TestGetLabelInOrgByName(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) diff --git a/models/login_source.go b/models/login_source.go index 7ff7e994eafb..f9bd496b3add 100644 --- a/models/login_source.go +++ b/models/login_source.go @@ -343,7 +343,7 @@ func CreateLoginSource(source *LoginSource) error { } else if has { return ErrLoginSourceAlreadyExist{source.Name} } - // Synchronization is only aviable with LDAP for now + // Synchronization is only available with LDAP for now if !source.IsLDAP() { source.IsSyncEnabled = false } diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 0e8b0d0e3db5..de60d89bbe78 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -187,7 +187,7 @@ var migrations = []Migration{ // v122 -> v123 NewMigration("Add Require Signed Commits to ProtectedBranch", addRequireSignedCommits), // v123 -> v124 - NewMigration("Add original informations for reactions", addReactionOriginals), + NewMigration("Add original information for reactions", addReactionOriginals), // v124 -> v125 NewMigration("Add columns to user and repository", addUserRepoMissingColumns), // v125 -> v126 diff --git a/models/migrations/v111.go b/models/migrations/v111.go index b292f0c7d38a..95f0ec22dd38 100644 --- a/models/migrations/v111.go +++ b/models/migrations/v111.go @@ -141,8 +141,8 @@ func addBranchProtectionCanPushAndEnableWhitelist(x *xorm.Engine) error { return perm, err } - // Prevent strangers from checking out public repo of private orginization - // Allow user if they are collaborator of a repo within a private orginization but not a member of the orginization itself + // Prevent strangers from checking out public repo of private organization + // Allow user if they are collaborator of a repo within a private organization but not a member of the organization itself hasOrgVisible := true // Not SignedUser if user == nil { diff --git a/models/migrations/v147.go b/models/migrations/v147.go index 7488b370aace..ad4ec4ef7ffd 100644 --- a/models/migrations/v147.go +++ b/models/migrations/v147.go @@ -75,7 +75,7 @@ func createReviewsForCodeComments(x *xorm.Engine) error { RefRepoID int64 `xorm:"index"` // Repo where the referencing RefIssueID int64 `xorm:"index"` RefCommentID int64 `xorm:"index"` // 0 if origin is Issue title or content (or PR's) - RefAction int `xorm:"SMALLINT"` // What hapens if RefIssueID resolves + RefAction int `xorm:"SMALLINT"` // What happens if RefIssueID resolves RefIsPull bool } diff --git a/models/oauth2_application.go b/models/oauth2_application.go index 3509dba54e2f..5a924763be16 100644 --- a/models/oauth2_application.go +++ b/models/oauth2_application.go @@ -210,7 +210,7 @@ func UpdateOAuth2Application(opts UpdateOAuth2ApplicationOptions) (*OAuth2Applic return nil, err } if app.UID != opts.UserID { - return nil, fmt.Errorf("UID missmatch") + return nil, fmt.Errorf("UID mismatch") } app.Name = opts.Name @@ -376,7 +376,7 @@ func getOAuth2AuthorizationByCode(e Engine, code string) (auth *OAuth2Authorizat ////////////////////////////////////////////////////// -// OAuth2Grant represents the permission of an user for a specifc application to access resources +// OAuth2Grant represents the permission of an user for a specific application to access resources type OAuth2Grant struct { ID int64 `xorm:"pk autoincr"` UserID int64 `xorm:"INDEX unique(user_application)"` @@ -537,7 +537,7 @@ type OAuth2Token struct { jwt.StandardClaims } -// ParseOAuth2Token parses a singed jwt string +// ParseOAuth2Token parses a signed jwt string func ParseOAuth2Token(jwtToken string) (*OAuth2Token, error) { parsedToken, err := jwt.ParseWithClaims(jwtToken, &OAuth2Token{}, func(token *jwt.Token) (interface{}, error) { if token.Method == nil || token.Method.Alg() != oauth2.DefaultSigningKey.SigningMethod().Alg() { diff --git a/models/org.go b/models/org.go index 073b26c2f8b6..58fb26b1bb51 100644 --- a/models/org.go +++ b/models/org.go @@ -79,7 +79,7 @@ func (org *User) GetMembers() (err error) { return } -// FindOrgMembersOpts represensts find org members condtions +// FindOrgMembersOpts represensts find org members conditions type FindOrgMembersOpts struct { ListOptions OrgID int64 diff --git a/models/repo.go b/models/repo.go index 009e7a457d07..e158dc12dd81 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1616,7 +1616,7 @@ func DeleteRepository(doer *User, uid, repoID int64) error { sess.Close() // We should always delete the files after the database transaction succeed. If - // we delete the file but the database rollback, the repository will be borken. + // we delete the file but the database rollback, the repository will be broken. // Remove issue attachment files. for i := range attachmentPaths { diff --git a/models/repo_list.go b/models/repo_list.go index b4a6d9e438fc..b988cefface8 100644 --- a/models/repo_list.go +++ b/models/repo_list.go @@ -148,11 +148,11 @@ type SearchRepoOptions struct { AllLimited bool // Include also all public repositories of limited organisations // None -> include public and private // True -> include just private - // False -> incude just public + // False -> include just public IsPrivate util.OptionalBool // None -> include collaborative AND non-collaborative // True -> include just collaborative - // False -> incude just non-collaborative + // False -> include just non-collaborative Collaborate util.OptionalBool // None -> include forks AND non-forks // True -> include just forks diff --git a/models/repo_permission.go b/models/repo_permission.go index 4f043a58ccfa..f5138fc54ce4 100644 --- a/models/repo_permission.go +++ b/models/repo_permission.go @@ -176,7 +176,7 @@ func getUserRepoPermission(e Engine, repo *Repository, user *User) (perm Permiss return } - // Prevent strangers from checking out public repo of private orginization/users + // Prevent strangers from checking out public repo of private organization/users // Allow user if they are collaborator of a repo within a private user or a private organization but not a member of the organization itself if !hasOrgOrUserVisible(e, repo.Owner, user) && !isCollaborator { perm.AccessMode = AccessModeNone @@ -351,7 +351,7 @@ func hasAccessUnit(e Engine, user *User, repo *Repository, unitType UnitType, te return testMode <= mode, err } -// HasAccessUnit returns ture if user has testMode to the unit of the repository +// HasAccessUnit returns true if user has testMode to the unit of the repository func HasAccessUnit(user *User, repo *Repository, unitType UnitType, testMode AccessMode) (bool, error) { return hasAccessUnit(x, user, repo, unitType, testMode) } diff --git a/models/repo_pushmirror.go b/models/repo_pushmirror.go index bdd4198f92b4..439972ffa6cc 100644 --- a/models/repo_pushmirror.go +++ b/models/repo_pushmirror.go @@ -91,7 +91,7 @@ func GetPushMirrorByID(ID int64) (*PushMirror, error) { return m, nil } -// GetPushMirrorsByRepoID returns push-mirror informations of a repository. +// GetPushMirrorsByRepoID returns push-mirror information of a repository. func GetPushMirrorsByRepoID(repoID int64) ([]*PushMirror, error) { mirrors := make([]*PushMirror, 0, 10) return mirrors, x.Where("repo_id=?", repoID).Find(&mirrors) diff --git a/models/review.go b/models/review.go index 316cbe4da642..acb54d970fdc 100644 --- a/models/review.go +++ b/models/review.go @@ -466,7 +466,7 @@ func GetReviewersByIssueID(issueID int64) ([]*Review, error) { return nil, err } - // Get latest review of each reviwer, sorted in order they were made + // Get latest review of each reviewer, sorted in order they were made if err := sess.SQL("SELECT * FROM review WHERE id IN (SELECT max(id) as id FROM review WHERE issue_id = ? AND reviewer_team_id = 0 AND type in (?, ?, ?) AND dismissed = ? AND original_author_id = 0 GROUP BY issue_id, reviewer_id) ORDER BY review.updated_unix ASC", issueID, ReviewTypeApprove, ReviewTypeReject, ReviewTypeRequest, false). Find(&reviews); err != nil { @@ -491,7 +491,7 @@ func GetReviewersByIssueID(issueID int64) ([]*Review, error) { func GetReviewersFromOriginalAuthorsByIssueID(issueID int64) ([]*Review, error) { reviews := make([]*Review, 0, 10) - // Get latest review of each reviwer, sorted in order they were made + // Get latest review of each reviewer, sorted in order they were made if err := x.SQL("SELECT * FROM review WHERE id IN (SELECT max(id) as id FROM review WHERE issue_id = ? AND reviewer_team_id = 0 AND type in (?, ?, ?) AND original_author_id <> 0 GROUP BY issue_id, original_author_id) ORDER BY review.updated_unix ASC", issueID, ReviewTypeApprove, ReviewTypeReject, ReviewTypeRequest). Find(&reviews); err != nil { diff --git a/models/topic.go b/models/topic.go index 31e81c8d0ff1..19c572fefebf 100644 --- a/models/topic.go +++ b/models/topic.go @@ -195,7 +195,7 @@ func FindTopics(opts *FindTopicOptions) (topics []*Topic, err error) { return topics, sess.Desc("topic.repo_count").Find(&topics) } -// GetRepoTopicByName retrives topic from name for a repo if it exist +// GetRepoTopicByName retrieves topic from name for a repo if it exist func GetRepoTopicByName(repoID int64, topicName string) (*Topic, error) { return getRepoTopicByName(x, repoID, topicName) } diff --git a/models/user.go b/models/user.go index ce96a144af25..3b8ce79251f0 100644 --- a/models/user.go +++ b/models/user.go @@ -1631,7 +1631,7 @@ func (opts *SearchUserOptions) toConds() builder.Cond { // If Admin - they see all users! if !opts.Actor.IsAdmin { - // Force visiblity for privacy + // Force visibility for privacy var accessCond builder.Cond if !opts.Actor.IsRestricted { accessCond = builder.Or( @@ -1647,7 +1647,7 @@ func (opts *SearchUserOptions) toConds() builder.Cond { } } else { - // Force visiblity for privacy + // Force visibility for privacy // Not logged in - only public users cond = cond.And(builder.In("visibility", structs.VisibleTypePublic)) } diff --git a/models/user_mail.go b/models/user_mail.go index 320f2cb05a32..89cbdf12a488 100644 --- a/models/user_mail.go +++ b/models/user_mail.go @@ -269,7 +269,7 @@ func MakeEmailPrimary(email *EmailAddress) error { return err } - // 3. update new primay email + // 3. update new primary email email.IsPrimary = true if _, err = sess.ID(email.ID).Cols("is_primary").Update(email); err != nil { return err diff --git a/modules/context/csrf.go b/modules/context/csrf.go index ba0e9f6cde77..8d179ca90474 100644 --- a/modules/context/csrf.go +++ b/modules/context/csrf.go @@ -22,6 +22,7 @@ import ( "net/http" "time" + "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/web/middleware" "github.com/unknwon/com" @@ -266,7 +267,12 @@ func Validate(ctx *Context, x CSRF) { -1, x.GetCookiePath(), x.GetCookieDomain()) // FIXME: Do we need to set the Secure, httpOnly and SameSite values too? - x.Error(ctx.Resp) + if middleware.IsAPIPath(ctx.Req) { + x.Error(ctx.Resp) + return + } + ctx.Flash.Error(ctx.Tr("error.invalid_csrf")) + ctx.Redirect(setting.AppSubURL + "/") } return } @@ -277,10 +283,19 @@ func Validate(ctx *Context, x CSRF) { -1, x.GetCookiePath(), x.GetCookieDomain()) // FIXME: Do we need to set the Secure, httpOnly and SameSite values too? - x.Error(ctx.Resp) + if middleware.IsAPIPath(ctx.Req) { + x.Error(ctx.Resp) + return + } + ctx.Flash.Error(ctx.Tr("error.invalid_csrf")) + ctx.Redirect(setting.AppSubURL + "/") } return } - - http.Error(ctx.Resp, "Bad Request: no CSRF token present", http.StatusBadRequest) + if middleware.IsAPIPath(ctx.Req) { + http.Error(ctx.Resp, "Bad Request: no CSRF token present", http.StatusBadRequest) + return + } + ctx.Flash.Error(ctx.Tr("error.missing_csrf")) + ctx.Redirect(setting.AppSubURL + "/") } diff --git a/modules/context/repo.go b/modules/context/repo.go index 72d1cf4c8561..ea8323bdfc22 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -38,7 +38,7 @@ var IssueTemplateDirCandidates = []string{ ".gitlab/issue_template", } -// PullRequest contains informations to make a pull request +// PullRequest contains information to make a pull request type PullRequest struct { BaseRepo *models.Repository Allowed bool diff --git a/modules/git/blame.go b/modules/git/blame.go index c2129c9e1cf1..fcbf183981c3 100644 --- a/modules/git/blame.go +++ b/modules/git/blame.go @@ -34,7 +34,7 @@ type BlameReader struct { var shaLineRegex = regexp.MustCompile("^([a-z0-9]{40})") -// NextPart returns next part of blame (sequencial code lines with the same commit) +// NextPart returns next part of blame (sequential code lines with the same commit) func (r *BlameReader) NextPart() (*BlamePart, error) { var blamePart *BlamePart diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go index 5b417cd77455..16ee5b2fd62f 100644 --- a/modules/git/repo_commit.go +++ b/modules/git/repo_commit.go @@ -110,7 +110,7 @@ func (repo *Repository) searchCommits(id SHA1, opts SearchCommitsOptions) (*list } } - // add commiters if present in search query + // add committers if present in search query if len(opts.Committers) > 0 { for _, v := range opts.Committers { args = append(args, "--committer="+v) @@ -150,7 +150,7 @@ func (repo *Repository) searchCommits(id SHA1, opts SearchCommitsOptions) (*list stdout = append(stdout, '\n') } - // if there are any keywords (ie not commiter:, author:, time:) + // if there are any keywords (ie not committer:, author:, time:) // then let's iterate over them if len(opts.Keywords) > 0 { for _, v := range opts.Keywords { @@ -195,12 +195,12 @@ func (repo *Repository) FileChangedBetweenCommits(filename, id1, id2 string) (bo return len(strings.TrimSpace(string(stdout))) > 0, nil } -// FileCommitsCount return the number of files at a revison +// FileCommitsCount return the number of files at a revision func (repo *Repository) FileCommitsCount(revision, file string) (int64, error) { return CommitsCountFiles(repo.Path, []string{revision}, []string{file}) } -// CommitsByFileAndRange return the commits according revison file and the page +// CommitsByFileAndRange return the commits according revision file and the page func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (*list.List, error) { skip := (page - 1) * setting.Git.CommitsRangeSize @@ -240,7 +240,7 @@ func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) ( return repo.parsePrettyFormatLogToList(stdout) } -// CommitsByFileAndRangeNoFollow return the commits according revison file and the page +// CommitsByFileAndRangeNoFollow return the commits according revision file and the page func (repo *Repository) CommitsByFileAndRangeNoFollow(revision, file string, page int) (*list.List, error) { stdout, err := NewCommand("log", revision, "--skip="+strconv.Itoa((page-1)*50), "--max-count="+strconv.Itoa(setting.Git.CommitsRangeSize), prettyLogFormat, "--", file).RunInDirBytes(repo.Path) diff --git a/modules/git/repo_stats.go b/modules/git/repo_stats.go index cb2a2bcf5102..aca5ab21ccb2 100644 --- a/modules/git/repo_stats.go +++ b/modules/git/repo_stats.go @@ -33,7 +33,7 @@ type CodeActivityAuthor struct { Commits int64 } -// GetCodeActivityStats returns code statistics for acitivity page +// GetCodeActivityStats returns code statistics for activity page func (repo *Repository) GetCodeActivityStats(fromTime time.Time, branch string) (*CodeActivityStats, error) { stats := &CodeActivityStats{} diff --git a/modules/git/utils.go b/modules/git/utils.go index d95218941606..13926fba72df 100644 --- a/modules/git/utils.go +++ b/modules/git/utils.go @@ -13,7 +13,7 @@ import ( "sync" ) -// ObjectCache provides thread-safe cache opeations. +// ObjectCache provides thread-safe cache operations. type ObjectCache struct { lock sync.RWMutex cache map[string]interface{} diff --git a/modules/indexer/code/elastic_search.go b/modules/indexer/code/elastic_search.go index 38a97ad888c0..569917f151f4 100644 --- a/modules/indexer/code/elastic_search.go +++ b/modules/indexer/code/elastic_search.go @@ -284,7 +284,7 @@ func (b *ElasticSearchIndexer) Delete(repoID int64) error { } // indexPos find words positions for start and the following end on content. It will -// return the beginning position of the frist start and the ending position of the +// return the beginning position of the first start and the ending position of the // first end following the start string. // If not found any of the positions, it will return -1, -1. func indexPos(content, start, end string) (int, int) { @@ -308,8 +308,8 @@ func convertResult(searchResult *elastic.SearchResult, kw string, pageSize int) var startIndex, endIndex int = -1, -1 c, ok := hit.Highlight["content"] if ok && len(c) > 0 { - // FIXME: Since the high lighting content will include and for the keywords, - // now we should find the poisitions. But how to avoid html content which contains the + // FIXME: Since the highlighting content will include and for the keywords, + // now we should find the positions. But how to avoid html content which contains the // and tags? If elastic search has handled that? startIndex, endIndex = indexPos(c[0], "", "") if startIndex == -1 { diff --git a/modules/lfs/shared.go b/modules/lfs/shared.go index 8343d12e1d60..d010b05ee56a 100644 --- a/modules/lfs/shared.go +++ b/modules/lfs/shared.go @@ -49,7 +49,7 @@ type ObjectResponse struct { Error *ObjectError `json:"error,omitempty"` } -// Link provides a structure with informations about how to access a object. +// Link provides a structure with information about how to access a object. type Link struct { Href string `json:"href"` Header map[string]string `json:"header,omitempty"` diff --git a/modules/log/colors_router.go b/modules/log/colors_router.go index e291a0da99da..3064e005cfa9 100644 --- a/modules/log/colors_router.go +++ b/modules/log/colors_router.go @@ -19,7 +19,7 @@ var statusToColor = map[int][]byte{ 500: ColorBytes(Bold, BgRed), } -// ColoredStatus addes colors for HTTP status +// ColoredStatus adds colors for HTTP status func ColoredStatus(status int, s ...string) *ColoredValue { color, ok := statusToColor[status] if !ok { @@ -43,7 +43,7 @@ var methodToColor = map[string][]byte{ "HEAD": ColorBytes(FgBlue, Faint), } -// ColoredMethod addes colors for HtTP methos on log +// ColoredMethod adds colors for HTTP methods on log func ColoredMethod(method string) *ColoredValue { color, ok := methodToColor[method] if !ok { @@ -72,7 +72,7 @@ var ( wayTooLong = ColorBytes(BgMagenta) ) -// ColoredTime addes colors for time on log +// ColoredTime adds colors for time on log func ColoredTime(duration time.Duration) *ColoredValue { for i, k := range durations { if duration < k { diff --git a/modules/markup/html.go b/modules/markup/html.go index 7afd8114c1b3..6d0b4fbea2f3 100644 --- a/modules/markup/html.go +++ b/modules/markup/html.go @@ -274,7 +274,7 @@ func RenderDescriptionHTML( } // RenderEmoji for when we want to just process emoji and shortcodes -// in various places it isn't already run through the normal markdown procesor +// in various places it isn't already run through the normal markdown processor func RenderEmoji( content string, ) (string, error) { diff --git a/modules/markup/html_test.go b/modules/markup/html_test.go index a494c5bd1831..dff9102beddb 100644 --- a/modules/markup/html_test.go +++ b/modules/markup/html_test.go @@ -138,13 +138,13 @@ func TestRender_links(t *testing.T) { `

http://www.example.com/wpstyle/?p=364

`) test( "https://www.example.com/foo/?bar=baz&inga=42&quux", - `

https://www.example.com/foo/?bar=baz&inga=42&quux

`) + `

https://www.example.com/foo/?bar=baz&inga=42&quux

`) test( "http://142.42.1.1/", `

http://142.42.1.1/

`) test( "https://github.com/go-gitea/gitea/?p=aaa/bbb.html#ccc-ddd", - `

https://github.com/go-gitea/gitea/?p=aaa/bbb.html#ccc-ddd

`) + `

https://github.com/go-gitea/gitea/?p=aaa/bbb.html#ccc-ddd

`) test( "https://en.wikipedia.org/wiki/URL_(disambiguation)", `

https://en.wikipedia.org/wiki/URL_(disambiguation)

`) @@ -162,7 +162,7 @@ func TestRender_links(t *testing.T) { `

ftp://gitea.com/file.txt

`) test( "magnet:?xt=urn:btih:5dee65101db281ac9c46344cd6b175cdcadabcde&dn=download", - `

magnet:?xt=urn:btih:5dee65101db281ac9c46344cd6b175cdcadabcde&dn=download

`) + `

magnet:?xt=urn:btih:5dee65101db281ac9c46344cd6b175cdcadabcde&dn=download

`) // Test that should *not* be turned into URL test( diff --git a/modules/markup/markdown/ast.go b/modules/markup/markdown/ast.go index d735ff5ebd84..5191d94cdd85 100644 --- a/modules/markup/markdown/ast.go +++ b/modules/markup/markdown/ast.go @@ -74,7 +74,7 @@ func IsSummary(node ast.Node) bool { return ok } -// TaskCheckBoxListItem is a block that repressents a list item of a markdown block with a checkbox +// TaskCheckBoxListItem is a block that represents a list item of a markdown block with a checkbox type TaskCheckBoxListItem struct { *ast.ListItem IsChecked bool diff --git a/modules/markup/mdstripper/mdstripper_test.go b/modules/markup/mdstripper/mdstripper_test.go index 9efcc359496c..13cea0ff72a1 100644 --- a/modules/markup/mdstripper/mdstripper_test.go +++ b/modules/markup/mdstripper/mdstripper_test.go @@ -25,7 +25,7 @@ func TestMarkdownStripper(t *testing.T) { This is [one](link) to paradise. This **is emphasized**. -This: should coallesce. +This: should coalesce. ` + "```" + ` This is a code block. @@ -44,7 +44,7 @@ A HIDDEN ` + "`" + `GHOST` + "`" + ` IN THIS LINE. "This", "is emphasized", ".", - "This: should coallesce.", + "This: should coalesce.", "Bullet 1", "Bullet 2", "A HIDDEN", diff --git a/modules/migrations/base/downloader.go b/modules/migrations/base/downloader.go index 2388b2dd6e77..71c8f3eaf978 100644 --- a/modules/migrations/base/downloader.go +++ b/modules/migrations/base/downloader.go @@ -18,7 +18,7 @@ type GetCommentOptions struct { PageSize int } -// Downloader downloads the site repo informations +// Downloader downloads the site repo information type Downloader interface { SetContext(context.Context) GetRepoInfo() (*Repository, error) diff --git a/modules/migrations/base/label.go b/modules/migrations/base/label.go index 0c86b547f194..5a66e7620f62 100644 --- a/modules/migrations/base/label.go +++ b/modules/migrations/base/label.go @@ -5,7 +5,7 @@ package base -// Label defines a standard label informations +// Label defines a standard label information type Label struct { Name string Color string diff --git a/modules/migrations/base/uploader.go b/modules/migrations/base/uploader.go index dfcf81d05224..4d0257df37b0 100644 --- a/modules/migrations/base/uploader.go +++ b/modules/migrations/base/uploader.go @@ -5,7 +5,7 @@ package base -// Uploader uploads all the informations of one repository +// Uploader uploads all the information of one repository type Uploader interface { MaxBatchInsertSize(tp string) int CreateRepo(repo *Repository, opts MigrateOptions) error diff --git a/modules/migrations/github.go b/modules/migrations/github.go index 9b897662d030..7d4c492c24c3 100644 --- a/modules/migrations/github.go +++ b/modules/migrations/github.go @@ -61,7 +61,7 @@ func (f *GithubDownloaderV3Factory) GitServiceType() structs.GitServiceType { return structs.GithubService } -// GithubDownloaderV3 implements a Downloader interface to get repository informations +// GithubDownloaderV3 implements a Downloader interface to get repository information // from github via APIv3 type GithubDownloaderV3 struct { base.NullDownloader diff --git a/modules/migrations/gitlab.go b/modules/migrations/gitlab.go index c83989f771fb..fe763f990033 100644 --- a/modules/migrations/gitlab.go +++ b/modules/migrations/gitlab.go @@ -56,7 +56,7 @@ func (f *GitlabDownloaderFactory) GitServiceType() structs.GitServiceType { return structs.GitlabService } -// GitlabDownloader implements a Downloader interface to get repository informations +// GitlabDownloader implements a Downloader interface to get repository information // from gitlab via go-gitlab // - issueCount is incremented in GetIssues() to ensure PR and Issue numbers do not overlap, // because Gitlab has individual Issue and Pull Request numbers. diff --git a/modules/migrations/gogs.go b/modules/migrations/gogs.go index d689b0da1155..9e663fd1fee4 100644 --- a/modules/migrations/gogs.go +++ b/modules/migrations/gogs.go @@ -57,7 +57,7 @@ func (f *GogsDownloaderFactory) GitServiceType() structs.GitServiceType { return structs.GogsService } -// GogsDownloader implements a Downloader interface to get repository informations +// GogsDownloader implements a Downloader interface to get repository information // from gogs via API type GogsDownloader struct { base.NullDownloader diff --git a/modules/notification/base/null.go b/modules/notification/base/null.go index e61b37a94309..32fe259bca8d 100644 --- a/modules/notification/base/null.go +++ b/modules/notification/base/null.go @@ -143,7 +143,7 @@ func (*NullNotifier) NotifyPushCommits(pusher *models.User, repo *models.Reposit func (*NullNotifier) NotifyCreateRef(doer *models.User, repo *models.Repository, refType, refFullName string) { } -// NotifyDeleteRef notifies branch or tag deleteion to notifiers +// NotifyDeleteRef notifies branch or tag deletion to notifiers func (*NullNotifier) NotifyDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string) { } diff --git a/modules/references/references_test.go b/modules/references/references_test.go index 293322a7142e..11a31b41b683 100644 --- a/modules/references/references_test.go +++ b/modules/references/references_test.go @@ -481,7 +481,7 @@ func TestParseCloseKeywords(t *testing.T) { {",$!", "", ""}, {"1234", "", ""}, } { - // The patern only needs to match the part that precedes the reference. + // The pattern only needs to match the part that precedes the reference. // getCrossReference() takes care of finding the reference itself. pat := makeKeywordsPat([]string{test.pattern}) if test.expected == "" { diff --git a/modules/repofiles/action_test.go b/modules/repofiles/action_test.go index 290844de0267..97632df68fb8 100644 --- a/modules/repofiles/action_test.go +++ b/modules/repofiles/action_test.go @@ -250,7 +250,7 @@ func TestUpdateIssuesCommit_AnotherRepoNoPermission(t *testing.T) { user := models.AssertExistsAndLoadBean(t, &models.User{ID: 10}).(*models.User) // Test that a push with close reference *can not* close issue - // If the commiter doesn't have push rights in that repo + // If the committer doesn't have push rights in that repo pushCommits := []*repository.PushCommit{ { Sha1: "abcdef3", diff --git a/modules/repofiles/content_test.go b/modules/repofiles/content_test.go index 278216112296..253d43445929 100644 --- a/modules/repofiles/content_test.go +++ b/modules/repofiles/content_test.go @@ -69,7 +69,7 @@ func TestGetContents(t *testing.T) { assert.NoError(t, err) }) - t.Run("Get REAMDE.md contents with ref as empty string (should then use the repo's default branch) with GetContents()", func(t *testing.T) { + t.Run("Get README.md contents with ref as empty string (should then use the repo's default branch) with GetContents()", func(t *testing.T) { fileContentResponse, err := GetContents(ctx.Repo.Repository, treePath, "", false) assert.EqualValues(t, expectedContentsResponse, fileContentResponse) assert.NoError(t, err) @@ -132,7 +132,7 @@ func TestGetContentsOrListForFile(t *testing.T) { assert.NoError(t, err) }) - t.Run("Get REAMDE.md contents with ref as empty string (should then use the repo's default branch) with GetContentsOrList()", func(t *testing.T) { + t.Run("Get README.md contents with ref as empty string (should then use the repo's default branch) with GetContentsOrList()", func(t *testing.T) { fileContentResponse, err := GetContentsOrList(ctx.Repo.Repository, treePath, "") assert.EqualValues(t, expectedContentsResponse, fileContentResponse) assert.NoError(t, err) diff --git a/modules/repository/adopt.go b/modules/repository/adopt.go index a37f77049633..321e6ab7672c 100644 --- a/modules/repository/adopt.go +++ b/modules/repository/adopt.go @@ -129,12 +129,12 @@ func ListUnadoptedRepositories(query string, opts *models.ListOptions) ([]string var err error globUser, err = glob.Compile(qsplit[0]) if err != nil { - log.Info("Invalid glob expresion '%s' (skipped): %v", qsplit[0], err) + log.Info("Invalid glob expression '%s' (skipped): %v", qsplit[0], err) } if len(qsplit) > 1 { globRepo, err = glob.Compile(qsplit[1]) if err != nil { - log.Info("Invalid glob expresion '%s' (skipped): %v", qsplit[1], err) + log.Info("Invalid glob expression '%s' (skipped): %v", qsplit[1], err) } } } diff --git a/modules/secret/secret.go b/modules/secret/secret.go index 7a06730c392d..976924ac606d 100644 --- a/modules/secret/secret.go +++ b/modules/secret/secret.go @@ -17,7 +17,7 @@ import ( "code.gitea.io/gitea/modules/util" ) -// New creats a new secret +// New creates a new secret func New() (string, error) { return NewWithLength(44) } diff --git a/modules/setting/indexer.go b/modules/setting/indexer.go index f170a8d3afce..2e9d8b288356 100644 --- a/modules/setting/indexer.go +++ b/modules/setting/indexer.go @@ -101,7 +101,7 @@ func IndexerGlobFromString(globstr string) []glob.Glob { expr = strings.TrimSpace(expr) if expr != "" { if g, err := glob.Compile(expr, '.', '/'); err != nil { - log.Info("Invalid glob expresion '%s' (skipped): %v", expr, err) + log.Info("Invalid glob expression '%s' (skipped): %v", expr, err) } else { extarr = append(extarr, g) } diff --git a/modules/setting/session.go b/modules/setting/session.go index 97666c5e53da..bce73b51da64 100644 --- a/modules/setting/session.go +++ b/modules/setting/session.go @@ -15,7 +15,7 @@ import ( ) var ( - // SessionConfig difines Session settings + // SessionConfig defines Session settings SessionConfig = struct { Provider string // Provider configuration, it's corresponding to provider. diff --git a/modules/storage/storage.go b/modules/storage/storage.go index b3708908f818..2fe14b41ef0e 100644 --- a/modules/storage/storage.go +++ b/modules/storage/storage.go @@ -71,7 +71,7 @@ type ObjectStorage interface { IterateObjects(func(path string, obj Object) error) error } -// Copy copys a file from source ObjectStorage to dest ObjectStorage +// Copy copies a file from source ObjectStorage to dest ObjectStorage func Copy(dstStorage ObjectStorage, dstPath string, srcStorage ObjectStorage, srcPath string) (int64, error) { f, err := srcStorage.Open(srcPath) if err != nil { diff --git a/modules/task/migrate.go b/modules/task/migrate.go index 1d190faf872a..d7655112d351 100644 --- a/modules/task/migrate.go +++ b/modules/task/migrate.go @@ -74,7 +74,7 @@ func runMigrateTask(t *models.Task) (err error) { return } - // if repository is ready, then just finsih the task + // if repository is ready, then just finish the task if t.Repo.Status == models.RepositoryReady { return nil } diff --git a/modules/typesniffer/typesniffer.go b/modules/typesniffer/typesniffer.go index 7c89f66699c1..d257b8179b0a 100644 --- a/modules/typesniffer/typesniffer.go +++ b/modules/typesniffer/typesniffer.go @@ -21,7 +21,7 @@ const SvgMimeType = "image/svg+xml" var svgTagRegex = regexp.MustCompile(`(?si)\A\s*(?:(||>))\s*)*\/]`) var svgTagInXMLRegex = regexp.MustCompile(`(?si)\A<\?xml\b.*?\?>\s*(?:(||>))\s*)*\/]`) -// SniffedType contains informations about a blobs type. +// SniffedType contains information about a blobs type. type SniffedType struct { contentType string } diff --git a/modules/util/path.go b/modules/util/path.go index 2ac8f4d80a3e..e79747327d75 100644 --- a/modules/util/path.go +++ b/modules/util/path.go @@ -154,7 +154,7 @@ func StatDir(rootPath string, includeDir ...bool) ([]string, error) { return statDir(rootPath, "", isIncludeDir, false, false) } -// FileURLToPath extracts the path informations from a file://... url. +// FileURLToPath extracts the path information from a file://... url. func FileURLToPath(u *url.URL) (string, error) { if u.Scheme != "file" { return "", errors.New("URL scheme is not 'file': " + u.String()) diff --git a/modules/util/shellquote_test.go b/modules/util/shellquote_test.go index 2ddc6d763d86..be6ba372fdfb 100644 --- a/modules/util/shellquote_test.go +++ b/modules/util/shellquote_test.go @@ -33,7 +33,7 @@ func TestShellEscape(t *testing.T) { "~git/Gitea v1.13/gitea", `~git/"Gitea v1.13/gitea"`, }, { - "Bangs are unforutunately not predictable so need to be singlequoted", + "Bangs are unfortunately not predictable so need to be singlequoted", "C:/Program Files/Gitea!/gitea", `'C:/Program Files/Gitea!/gitea'`, }, { @@ -41,7 +41,7 @@ func TestShellEscape(t *testing.T) { "/home/git/Gitea\n\nWHY-WOULD-YOU-DO-THIS\n\nGitea/gitea", "'/home/git/Gitea\n\nWHY-WOULD-YOU-DO-THIS\n\nGitea/gitea'", }, { - "Similarly we should nicely handle mutiple single quotes if we have to single-quote", + "Similarly we should nicely handle multiple single quotes if we have to single-quote", "'!''!'''!''!'!'", `\''!'\'\''!'\'\'\''!'\'\''!'\''!'\'`, }, { diff --git a/modules/validation/helpers.go b/modules/validation/helpers.go index 343261aac5b5..617ec3578c8f 100644 --- a/modules/validation/helpers.go +++ b/modules/validation/helpers.go @@ -92,7 +92,7 @@ func IsValidExternalURL(uri string) bool { return false } - // TODO: Later it should be added to allow local network IP addreses + // TODO: Later it should be added to allow local network IP addresses // only if allowed by special setting return true diff --git a/modules/validation/helpers_test.go b/modules/validation/helpers_test.go index cc2a4b720d7a..f6f897e8210d 100644 --- a/modules/validation/helpers_test.go +++ b/modules/validation/helpers_test.go @@ -24,12 +24,12 @@ func Test_IsValidURL(t *testing.T) { valid: false, }, { - description: "Loobpack IPv4 URL", + description: "Loopback IPv4 URL", url: "http://127.0.1.1:5678/", valid: true, }, { - description: "Loobpack IPv6 URL", + description: "Loopback IPv6 URL", url: "https://[::1]/", valid: true, }, @@ -61,7 +61,7 @@ func Test_IsValidExternalURL(t *testing.T) { valid: true, }, { - description: "Loobpack IPv4 URL", + description: "Loopback IPv4 URL", url: "http://127.0.1.1:5678/", valid: false, }, diff --git a/modules/validation/refname_test.go b/modules/validation/refname_test.go index 974d9565632d..2d6458b9b5a5 100644 --- a/modules/validation/refname_test.go +++ b/modules/validation/refname_test.go @@ -12,7 +12,7 @@ import ( var gitRefNameValidationTestCases = []validationTestCase{ { - description: "Referece contains only characters", + description: "Reference name contains only characters", data: TestForm{ BranchName: "test", }, diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index dcdfa611ec95..7f58a11e7385 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -100,6 +100,8 @@ never = Never [error] occurred = An error has occurred report_message = If you are sure this is a Gitea bug, please search for issue on GitHub and open new issue if necessary. +missing_csrf = Bad Request: no CSRF token present +invalid_csrf = Bad Request: Invalid CSRF token [startpage] app_desc = A painless, self-hosted Git service diff --git a/options/locale/locale_pt-PT.ini b/options/locale/locale_pt-PT.ini index be8bfd8f60c1..7183f91e0082 100644 --- a/options/locale/locale_pt-PT.ini +++ b/options/locale/locale_pt-PT.ini @@ -1377,9 +1377,9 @@ pulls.tab_files=Ficheiros modificados pulls.reopen_to_merge=Reabra este pedido de integração para executar uma integração. pulls.cant_reopen_deleted_branch=Este pedido de integração não pode ser reaberto porque o ramo foi eliminado. pulls.merged=Integrado -pulls.merged_as=A integração foi executada como %[2]s. +pulls.merged_as=A integração foi executada no cometimento %[2]s. pulls.manually_merged=Integrado manualmente -pulls.manually_merged_as=A integração foi executada manualmente como %[2]s. +pulls.manually_merged_as=A integração foi executada manualmente no cometimento %[2]s. pulls.is_closed=O pedido de integração foi fechado. pulls.has_merged=A integração foi executada. pulls.title_wip_desc=`Inicie o título com %s para evitar que a integração seja executada acidentalmente.` diff --git a/routers/api/v1/repo/issue_tracked_time.go b/routers/api/v1/repo/issue_tracked_time.go index 642704800b5c..ad774b563bcc 100644 --- a/routers/api/v1/repo/issue_tracked_time.go +++ b/routers/api/v1/repo/issue_tracked_time.go @@ -526,7 +526,7 @@ func ListTrackedTimesByRepository(ctx *context.APIContext) { if opts.UserID == 0 { opts.UserID = ctx.User.ID } else { - ctx.Error(http.StatusForbidden, "", fmt.Errorf("query user not allowed not enouth rights")) + ctx.Error(http.StatusForbidden, "", fmt.Errorf("query by user not allowed; not enough rights")) return } } diff --git a/routers/api/v1/user/app.go b/routers/api/v1/user/app.go index 7b69c50d7eb7..9f355a828950 100644 --- a/routers/api/v1/user/app.go +++ b/routers/api/v1/user/app.go @@ -166,7 +166,7 @@ func DeleteAccessToken(ctx *context.APIContext) { case 1: tokenID = tokens[0].ID default: - ctx.Error(http.StatusUnprocessableEntity, "DeleteAccessTokenByID", fmt.Errorf("multible matches for token name '%s'", token)) + ctx.Error(http.StatusUnprocessableEntity, "DeleteAccessTokenByID", fmt.Errorf("multiple matches for token name '%s'", token)) return } } diff --git a/routers/web/admin/users.go b/routers/web/admin/users.go index e1903ab1dfaf..acccc516bb45 100644 --- a/routers/web/admin/users.go +++ b/routers/web/admin/users.go @@ -205,7 +205,7 @@ func prepareUserInfo(ctx *context.Context) *models.User { return u } -// EditUser show editting user page +// EditUser show editing user page func EditUser(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("admin.users.edit_account") ctx.Data["PageIsAdmin"] = true @@ -222,7 +222,7 @@ func EditUser(ctx *context.Context) { ctx.HTML(http.StatusOK, tplUserEdit) } -// EditUserPost response for editting user +// EditUserPost response for editing user func EditUserPost(ctx *context.Context) { form := web.GetForm(ctx).(*forms.AdminEditUserForm) ctx.Data["Title"] = ctx.Tr("admin.users.edit_account") diff --git a/routers/web/admin/users_test.go b/routers/web/admin/users_test.go index 5ce20d8fa777..3d0b11a77449 100644 --- a/routers/web/admin/users_test.go +++ b/routers/web/admin/users_test.go @@ -122,7 +122,7 @@ func TestNewUserPost_InvalidEmail(t *testing.T) { assert.NotEmpty(t, ctx.Flash.ErrorMsg) } -func TestNewUserPost_VisiblityDefaultPublic(t *testing.T) { +func TestNewUserPost_VisibilityDefaultPublic(t *testing.T) { models.PrepareTestEnv(t) ctx := test.MockContext(t, "admin/users/new") diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go index aed90c66f745..e848939187ce 100644 --- a/routers/web/org/setting.go +++ b/routers/web/org/setting.go @@ -39,7 +39,7 @@ func Settings(ctx *context.Context) { ctx.HTML(http.StatusOK, tplSettingsOptions) } -// SettingsPost response for settings change submited +// SettingsPost response for settings change submitted func SettingsPost(ctx *context.Context) { form := web.GetForm(ctx).(*forms.UpdateOrgSettingForm) ctx.Data["Title"] = ctx.Tr("org.settings") @@ -139,7 +139,7 @@ func SettingsAvatar(ctx *context.Context) { ctx.Redirect(ctx.Org.OrgLink + "/settings") } -// SettingsDeleteAvatar response for delete avatar on setings page +// SettingsDeleteAvatar response for delete avatar on settings page func SettingsDeleteAvatar(ctx *context.Context) { if err := ctx.Org.Organization.DeleteAvatar(); err != nil { ctx.Flash.Error(err.Error()) diff --git a/routers/web/repo/http.go b/routers/web/repo/http.go index 649d6d1eb1a3..3390f026a0c1 100644 --- a/routers/web/repo/http.go +++ b/routers/web/repo/http.go @@ -32,7 +32,7 @@ import ( repo_service "code.gitea.io/gitea/services/repository" ) -// httpBase implmentation git smart HTTP protocol +// httpBase implementation git smart HTTP protocol func httpBase(ctx *context.Context) (h *serviceHandler) { if setting.Repository.DisableHTTPGit { ctx.Resp.WriteHeader(http.StatusForbidden) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 9ef5c1d1f05f..9639ea82014a 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -831,7 +831,7 @@ func NewIssueChooseTemplate(ctx *context.Context) { ctx.HTML(http.StatusOK, tplIssueChoose) } -// ValidateRepoMetas check and returns repository's meta informations +// ValidateRepoMetas check and returns repository's meta information func ValidateRepoMetas(ctx *context.Context, form forms.CreateIssueForm, isPull bool) ([]int64, []int64, int64, int64) { var ( repo = ctx.Repo.Repository diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index 90d06d11c1e1..cf076bdf1a83 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -751,7 +751,7 @@ func renderCode(ctx *context.Context) { ctx.HTML(http.StatusOK, tplRepoHome) } -// RenderUserCards render a page show users according the input templaet +// RenderUserCards render a page show users according the input template func RenderUserCards(ctx *context.Context, total int, getter func(opts models.ListOptions) ([]*models.User, error), tpl base.TplName) { page := ctx.QueryInt("page") if page <= 0 { diff --git a/routers/web/user/auth.go b/routers/web/user/auth.go index 6b4beff0e081..9458bf5c95a9 100644 --- a/routers/web/user/auth.go +++ b/routers/web/user/auth.go @@ -1473,7 +1473,7 @@ func ActivateEmail(ctx *context.Context) { ctx.Redirect(setting.AppSubURL + "/user/settings/account") } -// ForgotPasswd render the forget pasword page +// ForgotPasswd render the forget password page func ForgotPasswd(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("auth.forgot_password_title") diff --git a/routers/web/web.go b/routers/web/web.go index 627c88aab1c5..7a47f479c0da 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -146,7 +146,7 @@ func Routes() *web.Route { routes.Get("/metrics", append(common, Metrics)...) } - // Removed: toolbox.Toolboxer middleware will provide debug informations which seems unnecessary + // Removed: toolbox.Toolboxer middleware will provide debug information which seems unnecessary common = append(common, context.Contexter()) // Get user from session if logged in. diff --git a/services/auth/sspi_windows.go b/services/auth/sspi_windows.go index d1289a76174b..bb0291d2c9ba 100644 --- a/services/auth/sspi_windows.go +++ b/services/auth/sspi_windows.go @@ -73,7 +73,7 @@ func (s *SSPI) Free() error { } // Verify uses SSPI (Windows implementation of SPNEGO) to authenticate the request. -// If authentication is successful, returs the corresponding user object. +// If authentication is successful, returns the corresponding user object. // If negotiation should continue or authentication fails, immediately returns a 401 HTTP // response code, as required by the SPNEGO protocol. func (s *SSPI) Verify(req *http.Request, w http.ResponseWriter, store DataStore, sess SessionStore) *models.User { diff --git a/services/issue/assignee.go b/services/issue/assignee.go index f24a242f6b7d..12addede7588 100644 --- a/services/issue/assignee.go +++ b/services/issue/assignee.go @@ -25,7 +25,7 @@ func DeleteNotPassedAssignee(issue *models.Issue, doer *models.User, assignees [ } if !found { - // This function also does comments and hooks, which is why we call it seperatly instead of directly removing the assignees here + // This function also does comments and hooks, which is why we call it separately instead of directly removing the assignees here if _, _, err := ToggleAssignee(issue, doer, assignee.ID); err != nil { return err } diff --git a/services/mailer/mailer.go b/services/mailer/mailer.go index 6b86734bf845..fae8d473e341 100644 --- a/services/mailer/mailer.go +++ b/services/mailer/mailer.go @@ -304,7 +304,7 @@ var Sender gomail.Sender // NewContext start mail queue service func NewContext() { // Need to check if mailQueue is nil because in during reinstall (user had installed - // before but swithed install lock off), this function will be called again + // before but switched install lock off), this function will be called again // while mail queue is already processing tasks, and produces a race condition. if setting.MailService == nil || mailQueue != nil { return diff --git a/services/wiki/wiki_test.go b/services/wiki/wiki_test.go index 19f298f2d641..b35b86d655be 100644 --- a/services/wiki/wiki_test.go +++ b/services/wiki/wiki_test.go @@ -140,7 +140,7 @@ func TestRepository_AddWikiPage(t *testing.T) { wikiPath := NameToFilename(wikiName) entry, err := masterTree.GetTreeEntryByPath(wikiPath) assert.NoError(t, err) - assert.Equal(t, wikiPath, entry.Name(), "%s not addded correctly", wikiName) + assert.Equal(t, wikiPath, entry.Name(), "%s not added correctly", wikiName) }) } diff --git a/vendor/github.com/microcosm-cc/bluemonday/CONTRIBUTING.md b/vendor/github.com/microcosm-cc/bluemonday/CONTRIBUTING.md index d2b12302f9e5..1d4b24434595 100644 --- a/vendor/github.com/microcosm-cc/bluemonday/CONTRIBUTING.md +++ b/vendor/github.com/microcosm-cc/bluemonday/CONTRIBUTING.md @@ -9,6 +9,7 @@ Third-party patches are essential for keeping bluemonday secure and offering the ## Guidelines 1. Do not vendor dependencies. As a security package, were we to vendor dependencies the projects that then vendor bluemonday may not receive the latest security updates to the dependencies. By not vendoring dependencies the project that implements bluemonday will vendor the latest version of any dependent packages. Vendoring is a project problem, not a package problem. bluemonday will be tested against the latest version of dependencies periodically and during any PR/merge. +2. I do not care about spelling mistakes or whitespace and I do not believe that you should either. PRs therefore must be functional in their nature or be substantial and impactful if documentation or examples. ## Submitting an Issue diff --git a/vendor/github.com/microcosm-cc/bluemonday/go.mod b/vendor/github.com/microcosm-cc/bluemonday/go.mod index 02cf2eac30d4..0e9028a62f40 100644 --- a/vendor/github.com/microcosm-cc/bluemonday/go.mod +++ b/vendor/github.com/microcosm-cc/bluemonday/go.mod @@ -3,7 +3,8 @@ module github.com/microcosm-cc/bluemonday go 1.16 require ( + github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d github.com/aymerick/douceur v0.2.0 github.com/gorilla/css v1.0.0 // indirect - golang.org/x/net v0.0.0-20210610132358-84b48f89b13b + golang.org/x/net v0.0.0-20210614182718-04defd469f4e ) diff --git a/vendor/github.com/microcosm-cc/bluemonday/go.sum b/vendor/github.com/microcosm-cc/bluemonday/go.sum index 930d271e36ad..049d51658ef1 100644 --- a/vendor/github.com/microcosm-cc/bluemonday/go.sum +++ b/vendor/github.com/microcosm-cc/bluemonday/go.sum @@ -1,3 +1,5 @@ +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= @@ -6,6 +8,8 @@ golang.org/x/net v0.0.0-20210421230115-4e50805a0758 h1:aEpZnXcAmXkd6AvLb2OPt+EN1 golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/vendor/github.com/microcosm-cc/bluemonday/sanitize.go b/vendor/github.com/microcosm-cc/bluemonday/sanitize.go index 9bb87a68790d..5f4b60d714cf 100644 --- a/vendor/github.com/microcosm-cc/bluemonday/sanitize.go +++ b/vendor/github.com/microcosm-cc/bluemonday/sanitize.go @@ -130,7 +130,7 @@ func escapeUrlComponent(w stringWriterWriter, val string) error { return err } -// Query represents a query +// Query represents a single part of the query string, a query param type Query struct { Key string Value string @@ -138,6 +138,10 @@ type Query struct { } func parseQuery(query string) (values []Query, err error) { + // This is essentially a copy of parseQuery from + // https://golang.org/src/net/url/url.go but adjusted to build our values + // based on our type, which we need to preserve the ordering of the query + // string for query != "" { key := query if i := strings.IndexAny(key, "&;"); i >= 0 { @@ -213,43 +217,6 @@ func sanitizedURL(val string) (string, error) { return u.String(), nil } -func (p *Policy) writeLinkableBuf(buff stringWriterWriter, token *html.Token) (int, error) { - // do not escape multiple query parameters - tokenBuff := bytes.NewBuffer(make([]byte, 0, 1024)) // This should stay on the stack unless it gets too big - - tokenBuff.WriteByte('<') - tokenBuff.WriteString(token.Data) - for _, attr := range token.Attr { - tokenBuff.WriteByte(' ') - tokenBuff.WriteString(attr.Key) - tokenBuff.Write([]byte{'=', '"'}) - switch attr.Key { - case "href", "src": - u, ok := p.validURL(attr.Val) - if !ok { - tokenBuff.WriteString(html.EscapeString(attr.Val)) - continue - } - u, err := sanitizedURL(u) - if err == nil { - tokenBuff.WriteString(u) - } else { - // fallthrough - tokenBuff.WriteString(html.EscapeString(attr.Val)) - } - default: - // re-apply - tokenBuff.WriteString(html.EscapeString(attr.Val)) - } - tokenBuff.WriteByte('"') - } - if token.Type == html.SelfClosingTagToken { - tokenBuff.WriteString("/") - } - tokenBuff.WriteString(">") - return buff.Write(tokenBuff.Bytes()) -} - // Performs the actual sanitization process. func (p *Policy) sanitizeWithBuff(r io.Reader) *bytes.Buffer { var buff bytes.Buffer @@ -344,7 +311,9 @@ func (p *Policy) sanitize(r io.Reader, w io.Writer) error { aps = aa } if len(token.Attr) != 0 { - token.Attr = p.sanitizeAttrs(token.Data, token.Attr, aps) + token.Attr = escapeAttributes( + p.sanitizeAttrs(token.Data, token.Attr, aps), + ) } if len(token.Attr) == 0 { @@ -361,15 +330,8 @@ func (p *Policy) sanitize(r io.Reader, w io.Writer) error { } if !skipElementContent { - // do not escape multiple query parameters - if linkable(token.Data) { - if _, err := p.writeLinkableBuf(buff, &token); err != nil { - return err - } - } else { - if _, err := buff.WriteString(token.String()); err != nil { - return err - } + if _, err := buff.WriteString(token.String()); err != nil { + return err } } @@ -439,7 +401,7 @@ func (p *Policy) sanitize(r io.Reader, w io.Writer) error { } if len(token.Attr) != 0 { - token.Attr = p.sanitizeAttrs(token.Data, token.Attr, aps) + token.Attr = escapeAttributes(p.sanitizeAttrs(token.Data, token.Attr, aps)) } if len(token.Attr) == 0 && !p.allowNoAttrs(token.Data) { @@ -451,15 +413,8 @@ func (p *Policy) sanitize(r io.Reader, w io.Writer) error { } } if !skipElementContent { - // do not escape multiple query parameters - if linkable(token.Data) { - if _, err := p.writeLinkableBuf(buff, &token); err != nil { - return err - } - } else { - if _, err := buff.WriteString(token.String()); err != nil { - return err - } + if _, err := buff.WriteString(token.String()); err != nil { + return err } } @@ -569,9 +524,11 @@ attrsLoop: for _, ap := range apl { if ap.regexp != nil { if ap.regexp.MatchString(htmlAttr.Val) { + htmlAttr.Val = escapeAttribute(htmlAttr.Val) cleanAttrs = append(cleanAttrs, htmlAttr) } } else { + htmlAttr.Val = escapeAttribute(htmlAttr.Val) cleanAttrs = append(cleanAttrs, htmlAttr) } } @@ -1087,3 +1044,18 @@ func normaliseElementName(str string) string { `"`, ) } + +func escapeAttributes(attrs []html.Attribute) []html.Attribute { + escapedAttrs := []html.Attribute{} + for _, attr := range attrs { + attr.Val = escapeAttribute(attr.Val) + escapedAttrs = append(escapedAttrs, attr) + } + return escapedAttrs +} + +func escapeAttribute(val string) string { + val = strings.Replace(val, string([]rune{'\u00A0'}), ` `, -1) + val = strings.Replace(val, `"`, `"`, -1) + return val +} \ No newline at end of file diff --git a/vendor/modules.txt b/vendor/modules.txt index 883b0189e44d..41b6e2199fef 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -604,7 +604,7 @@ github.com/mholt/acmez/acme # github.com/mholt/archiver/v3 v3.5.0 ## explicit github.com/mholt/archiver/v3 -# github.com/microcosm-cc/bluemonday v1.0.14 +# github.com/microcosm-cc/bluemonday v1.0.15 ## explicit github.com/microcosm-cc/bluemonday github.com/microcosm-cc/bluemonday/css diff --git a/web_src/fomantic/build/semantic.css b/web_src/fomantic/build/semantic.css index 27ff073a567f..ee136e13ff7c 100644 --- a/web_src/fomantic/build/semantic.css +++ b/web_src/fomantic/build/semantic.css @@ -30873,7 +30873,7 @@ ol.ui.suffixed.list li:before, List ---------------*/ -/* Menu divider shouldnt apply */ +/* Menu divider shouldn't apply */ .ui.menu .list .item:before { background: none !important; @@ -31802,7 +31802,7 @@ Floated Menu / Item opacity: 1; } -/* Icon Gylph */ +/* Icon Glyph */ .ui.icon.menu i.icon:before { opacity: 1; diff --git a/web_src/fomantic/build/semantic.js b/web_src/fomantic/build/semantic.js index c1c80fcd2753..c68d266b0cd5 100644 --- a/web_src/fomantic/build/semantic.js +++ b/web_src/fomantic/build/semantic.js @@ -142,7 +142,7 @@ $.api = $.fn.api = function(parameters) { response = JSON.parse(response); } catch(e) { - // isnt json string + // isn't json string } } return response; @@ -2220,7 +2220,7 @@ $.fn.dimmer = function(parameters) { event: { click: function(event) { - module.verbose('Determining if event occured on dimmer', event); + module.verbose('Determining if event occurred on dimmer', event); if( $dimmer.find(event.target).length === 0 || $(event.target).is(selector.content) ) { module.hide(); event.stopImmediatePropagation(); @@ -3368,7 +3368,7 @@ $.fn.dropdown = function(parameters) { if(settings.onHide.call(element) !== false) { module.animate.hide(function() { module.remove.visible(); - // hidding search focus + // hiding search focus if ( module.is.focusedOnSearch() && preventBlur !== true ) { $search.blur(); } @@ -11937,7 +11937,7 @@ $.fn.progress = function(parameters) { * * @param min A minimum value within multiple values * @param total A total amount of multiple values - * @returns {number} A precison. Could be 1, 10, 100, ... 1e+10. + * @returns {number} A precision. Could be 1, 10, 100, ... 1e+10. */ derivePrecision: function(min, total) { var precisionPower = 0 @@ -12837,7 +12837,7 @@ $.fn.progress.settings = { nonNumeric : 'Progress value is non numeric', tooHigh : 'Value specified is above 100%', tooLow : 'Value specified is below 0%', - sumExceedsTotal : 'Sum of multple values exceed total', + sumExceedsTotal : 'Sum of multiple values exceed total', }, regExp: { @@ -18076,7 +18076,7 @@ $.fn.transition.settings = { // possible errors error: { - noAnimation : 'Element is no longer attached to DOM. Unable to animate. Use silent setting to surpress this warning in production.', + noAnimation : 'Element is no longer attached to DOM. Unable to animate. Use silent setting to suppress this warning in production.', repeated : 'That animation is already occurring, cancelling repeated animation', method : 'The method you called is not defined', support : 'This browser does not support CSS animations' diff --git a/web_src/js/index.js b/web_src/js/index.js index fc46a2e694bd..7a76b89f9b58 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -34,7 +34,7 @@ const commentMDEditors = {}; // Silence fomantic's error logging when tabs are used without a target content element $.fn.tab.settings.silent = true; -// Silence Vue's console advertisments in dev mode +// Silence Vue's console advertisements in dev mode // To use the Vue browser extension, enable the devtools option temporarily Vue.config.productionTip = false; Vue.config.devtools = false; @@ -461,7 +461,7 @@ function initCommentForm() { } // TODO: Which thing should be done for choosing review requests - // to make choosed items be shown on time here? + // to make chosen items be shown on time here? if (selector === 'select-reviewers-modify' || selector === 'select-assignees-modify') { return false; } diff --git a/web_src/less/_base.less b/web_src/less/_base.less index f9ac397e4e3d..dac18f2bf6e2 100644 --- a/web_src/less/_base.less +++ b/web_src/less/_base.less @@ -134,7 +134,7 @@ pre, code, kbd, samp { - font-size: .9em; /* compensate for monospace fonts being usually slighty larger */ + font-size: .9em; /* compensate for monospace fonts being usually slightly larger */ font-family: var(--fonts-monospace); } @@ -748,7 +748,7 @@ a.ui.card:hover, box-shadow: none; } - /* Overide semantic selector '.ui.menu:not(.vertical) .item > .button' */ + /* Override semantic selector '.ui.menu:not(.vertical) .item > .button' */ /* This fixes the commit graph button on the commits page */ .menu:not(.vertical) .item > .button.compact { diff --git a/web_src/less/helpers.less b/web_src/less/helpers.less index 3f58184f061a..5e067a1a3211 100644 --- a/web_src/less/helpers.less +++ b/web_src/less/helpers.less @@ -17,7 +17,7 @@ .mono { font-family: var(--fonts-monospace) !important; - font-size: .9em !important; /* compensate for monospace fonts being usually slighty larger */ + font-size: .9em !important; /* compensate for monospace fonts being usually slightly larger */ } .bold { font-weight: 600 !important; }