mirror of
https://github.com/go-gitea/gitea
synced 2024-11-14 14:14:25 +00:00
bbffcc3aec
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>
90 lines
3.3 KiB
Handlebars
90 lines
3.3 KiB
Handlebars
{{template "base/head" .}}
|
|
<div class="page-content organization teams">
|
|
{{template "org/header" .}}
|
|
<div class="ui container">
|
|
{{template "base/alert" .}}
|
|
<div class="ui grid">
|
|
{{template "org/team/sidebar" .}}
|
|
<div class="ui ten wide column">
|
|
{{template "org/team/navbar" .}}
|
|
{{$canAddRemove := and $.IsOrganizationOwner (not $.Team.IncludesAllRepositories)}}
|
|
{{if $canAddRemove}}
|
|
<div class="ui attached segment" id="repo-top-segment">
|
|
<div class="inline ui field left">
|
|
<form class="ui form" id="add-repo-form" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/add" method="post">
|
|
{{.CsrfTokenHtml}}
|
|
<div class="inline field ui left">
|
|
<div id="search-repo-box" data-uid="{{.Org.ID}}" class="ui search">
|
|
<div class="ui input">
|
|
<input class="prompt" name="repo_name" placeholder="{{.i18n.Tr "org.teams.search_repo_placeholder"}}" autocomplete="off" required>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<button class="ui green button">{{.i18n.Tr "add"}}</button>
|
|
</form>
|
|
</div>
|
|
<div class="inline ui field right">
|
|
<form class="ui form" id="repo-multiple-form" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/repositories" method="post">
|
|
<button class="ui red button delete-button right" data-url="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/removeall">{{.i18n.Tr "remove_all"}}</button>
|
|
<button class="ui green button add-all-button right" data-url="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/addall">{{.i18n.Tr "add_all"}}</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
<div class="ui bottom attached table segment repositories">
|
|
{{range .Team.Repos}}
|
|
<div class="item">
|
|
{{if $canAddRemove}}
|
|
<form method="post" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/remove">
|
|
{{$.CsrfTokenHtml}}
|
|
<button type="submit" class="ui red small button right" name="repoid" value="{{.ID}}">{{$.i18n.Tr "remove"}}</button>
|
|
</form>
|
|
{{end}}
|
|
<a class="member" href="{{$.Org.HomeLink}}/{{.Name | PathEscape}}">
|
|
{{if .IsPrivate}}
|
|
{{svg "octicon-lock"}}
|
|
{{else if .IsFork}}
|
|
{{svg "octicon-repo-forked"}}
|
|
{{else if .IsMirror}}
|
|
{{svg "octicon-mirror"}}
|
|
{{else}}
|
|
{{svg "octicon-repo"}}
|
|
{{end}}
|
|
<strong>{{$.Org.Name}}/{{.Name}}</strong>
|
|
</a>
|
|
</div>
|
|
{{else}}
|
|
<div class="item">
|
|
<span class="text grey italic">{{$.i18n.Tr "org.teams.repos.none"}}</span>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="ui small basic delete modal">
|
|
<div class="ui icon header">
|
|
{{svg "octicon-trash"}}
|
|
{{.i18n.Tr "org.teams.remove_all_repos_title"}}
|
|
</div>
|
|
<div class="content">
|
|
<p>{{.i18n.Tr "org.teams.remove_all_repos_desc"}}</p>
|
|
</div>
|
|
{{template "base/delete_modal_actions" .}}
|
|
</div>
|
|
|
|
<div class="ui small basic addall modal">
|
|
<div class="ui icon header">
|
|
<i class="globe icon"></i>
|
|
{{.i18n.Tr "org.teams.add_all_repos_title"}}
|
|
</div>
|
|
<div class="content">
|
|
<p>{{.i18n.Tr "org.teams.add_all_repos_desc"}}</p>
|
|
</div>
|
|
{{template "base/delete_modal_actions" .}}
|
|
</div>
|
|
|
|
{{template "base/footer" .}}
|