diff options
author | zeripath <art27@cantab.net> | 2021-11-16 18:18:25 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-16 18:18:25 +0000 |
commit | bbffcc3aecda040a40d49078e7141213bc8d78af (patch) | |
tree | 1b96c621edadabc85dec2c15c30b1b870af09467 /options | |
parent | 7e1ae380975df0afab3fdc04c7a926181e5daba9 (diff) | |
download | gitea-bbffcc3aecda040a40d49078e7141213bc8d78af.tar.gz gitea-bbffcc3aecda040a40d49078e7141213bc8d78af.zip |
Multiple Escaping Improvements (#17551)
There are multiple places where Gitea does not properly escape URLs that it is building and there are multiple places where it builds urls when there is already a simpler function available to use this.
This is an extensive PR attempting to fix these issues.
1. The first commit in this PR looks through all href, src and links in the Gitea codebase and has attempted to catch all the places where there is potentially incomplete escaping.
2. Whilst doing this we will prefer to use functions that create URLs over recreating them by hand.
3. All uses of strings should be directly escaped - even if they are not currently expected to contain escaping characters. The main benefit to doing this will be that we can consider relaxing the constraints on user names and reponames in future.
4. The next commit looks at escaping in the wiki and re-considers the urls that are used there. Using the improved escaping here wiki files containing '/'. (This implementation will currently still place all of the wiki files the root directory of the repo but this would not be difficult to change.)
5. The title generation in feeds is now properly escaped.
6. EscapePound is no longer needed - urls should be PathEscaped / QueryEscaped as necessary but then re-escaped with Escape when creating html with locales Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'options')
-rw-r--r-- | options/locale/locale_en-US.ini | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index af68876408..c39063e46e 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1409,7 +1409,7 @@ pulls.filter_branch = Filter branch pulls.no_results = No results found. pulls.nothing_to_compare = These branches are equal. There is no need to create a pull request. pulls.nothing_to_compare_and_allow_empty_pr = These branches are equal. This PR will be empty. -pulls.has_pull_request = `A pull request between these branches already exists: <a href="%[1]s/pulls/%[3]d">%[2]s#%[3]d</a>` +pulls.has_pull_request = `A pull request between these branches already exists: <a href="%[1]s">%[2]s#%[3]d</a>` pulls.create = Create Pull Request pulls.title_desc = wants to merge %[1]d commits from <code>%[2]s</code> into <code id="branch_target">%[3]s</code> pulls.merged_title_desc = merged %[1]d commits from <code>%[2]s</code> into <code>%[3]s</code> %[4]s @@ -2761,32 +2761,32 @@ notices.delete_success = The system notices have been deleted. [action] create_repo = created repository <a href="%s">%s</a> rename_repo = renamed repository from <code>%[1]s</code> to <a href="%[2]s">%[3]s</a> -commit_repo = pushed to <a href="%[1]s/src/branch/%[2]s">%[3]s</a> at <a href="%[1]s">%[4]s</a> -create_issue = `opened issue <a href="%s/issues/%s">%s#%[2]s</a>` -close_issue = `closed issue <a href="%s/issues/%s">%s#%[2]s</a>` -reopen_issue = `reopened issue <a href="%s/issues/%s">%s#%[2]s</a>` -create_pull_request = `created pull request <a href="%s/pulls/%s">%s#%[2]s</a>` -close_pull_request = `closed pull request <a href="%s/pulls/%s">%s#%[2]s</a>` -reopen_pull_request = `reopened pull request <a href="%s/pulls/%s">%s#%[2]s</a>` -comment_issue = `commented on issue <a href="%s/issues/%s">%s#%[2]s</a>` -comment_pull = `commented on pull request <a href="%s/pulls/%s">%s#%[2]s</a>` -merge_pull_request = `merged pull request <a href="%s/pulls/%s">%s#%[2]s</a>` +commit_repo = pushed to <a href="%[2]s">%[3]s</a> at <a href="%[1]s">%[4]s</a> +create_issue = `opened issue <a href="%[1]s">%[3]s#%[2]s</a>` +close_issue = `closed issue <a href="%[1]s">%[3]s#%[2]s</a>` +reopen_issue = `reopened issue <a href="%[1]s">%[3]s#%[2]s</a>` +create_pull_request = `created pull request <a href="%[1]s">%[3]s#%[2]s</a>` +close_pull_request = `closed pull request <a href="%[1]s">%[3]s#%[2]s</a>` +reopen_pull_request = `reopened pull request <a href="%[1]s">%[3]s#%[2]s</a>` +comment_issue = `commented on issue <a href="%[1]s">%[3]s#%[2]s</a>` +comment_pull = `commented on pull request <a href="%[1]s">%[3]s#%[2]s</a>` +merge_pull_request = `merged pull request <a href="%[1]s">%[3]s#%[2]s</a>` transfer_repo = transferred repository <code>%s</code> to <a href="%s">%s</a> -push_tag = pushed tag <a href="%s/src/tag/%s">%[4]s</a> to <a href="%[1]s">%[3]s</a> +push_tag = pushed tag <a href="%[2]s">%[3]s</a> to <a href="%[1]s">%[4]s</a> delete_tag = deleted tag %[2]s from <a href="%[1]s">%[3]s</a> delete_branch = deleted branch %[2]s from <a href="%[1]s">%[3]s</a> compare_branch = Compare compare_commits = Compare %d commits compare_commits_general = Compare commits -mirror_sync_push = synced commits to <a href="%[1]s/src/%[2]s">%[3]s</a> at <a href="%[1]s">%[4]s</a> from mirror -mirror_sync_create = synced new reference <a href="%s/src/%s">%[2]s</a> to <a href="%[1]s">%[3]s</a> from mirror +mirror_sync_push = synced commits to <a href="%[2]s">%[3]s</a> at <a href="%[1]s">%[4]s</a> from mirror +mirror_sync_create = synced new reference <a href="%[2]s">%[3]s</a> to <a href="%[1]s">%[4]s</a> from mirror mirror_sync_delete = synced and deleted reference <code>%[2]s</code> at <a href="%[1]s">%[3]s</a> from mirror -approve_pull_request = `approved <a href="%s/pulls/%s">%s#%[2]s</a>` -reject_pull_request = `suggested changes for <a href="%s/pulls/%s">%s#%[2]s</a>` -publish_release = `released <a href="%s/releases/tag/%s"> "%[4]s" </a> at <a href="%[1]s">%[3]s</a>` -review_dismissed = `dismissed review from <b>%[4]s</b> for <a href="%[1]s/pulls/%[2]s">%[3]s#%[2]s</a>` +approve_pull_request = `approved <a href="%[1]s">%[3]s#%[2]s</a>` +reject_pull_request = `suggested changes for <a href="%[1]s">%[3]s#%[2]s</a>` +publish_release = `released <a href="%[2]s"> "%[4]s" </a> at <a href="%[1]s">%[3]s</a>` +review_dismissed = `dismissed review from <b>%[4]s</b> for <a href="%[1]s">%[3]s#%[2]s</a>` review_dismissed_reason = Reason: -create_branch = created branch <a href="%[1]s/src/branch/%[2]s">%[3]s</a> in <a href="%[1]s">%[4]s</a> +create_branch = created branch <a href="%[2]s">%[3]s</a> in <a href="%[1]s">%[4]s</a> starred_repo = starred <a href="%[1]s">%[2]s</a> watched_repo = started watching <a href="%[1]s">%[2]s</a> |