mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-22 21:49:22 +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>
72 lines
2.6 KiB
Handlebars
72 lines
2.6 KiB
Handlebars
<div class="ui six wide column">
|
|
<h4 class="ui top attached header">
|
|
<strong>{{.Team.Name}}</strong>
|
|
<div class="ui right">
|
|
{{if .Team.IsMember $.SignedUser.ID}}
|
|
<form>
|
|
<button class="ui red tiny button delete-button" data-modal-id="leave-team-sidebar"
|
|
data-url="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}/action/leave" data-datauid="{{$.SignedUser.ID}}"
|
|
data-name="{{.Team.Name}}">{{$.i18n.Tr "org.teams.leave"}}</button>
|
|
</form>
|
|
{{else if .IsOrganizationOwner}}
|
|
<form method="post" action="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}/action/join">
|
|
{{$.CsrfTokenHtml}}
|
|
<input type="hidden" name="page" value="team"/>
|
|
<button type="submit" class="ui blue tiny button" name="uid" value="{{$.SignedUser.ID}}">{{$.i18n.Tr "org.teams.join"}}</button>
|
|
</form>
|
|
{{end}}
|
|
</div>
|
|
</h4>
|
|
<div class="ui attached table segment detail">
|
|
<div class="item">
|
|
{{if .Team.Description}}
|
|
{{.Team.Description}}
|
|
{{else}}
|
|
<span class="text grey italic">{{.i18n.Tr "org.teams.no_desc"}}</span>
|
|
{{end}}
|
|
</div>
|
|
|
|
<div class="item">
|
|
{{if eq .Team.LowerName "owners"}}
|
|
{{.i18n.Tr "org.teams.owners_permission_desc" | Str2html}}
|
|
{{else if (eq .Team.Authorize 1)}}
|
|
{{if .Team.IncludesAllRepositories}}
|
|
{{.i18n.Tr "org.teams.all_repositories_read_permission_desc" | Str2html}}
|
|
{{else}}
|
|
{{.i18n.Tr "org.teams.read_permission_desc" | Str2html}}
|
|
{{end}}
|
|
{{else if (eq .Team.Authorize 2)}}
|
|
{{if .Team.IncludesAllRepositories}}
|
|
{{.i18n.Tr "org.teams.all_repositories_write_permission_desc" | Str2html}}
|
|
{{else}}
|
|
{{.i18n.Tr "org.teams.write_permission_desc" | Str2html}}
|
|
{{end}}
|
|
{{else if (eq .Team.Authorize 3)}}
|
|
{{if .Team.IncludesAllRepositories}}
|
|
{{.i18n.Tr "org.teams.all_repositories_admin_permission_desc" | Str2html}}
|
|
{{else}}
|
|
{{.i18n.Tr "org.teams.admin_permission_desc" | Str2html}}
|
|
{{end}}
|
|
{{end}}
|
|
{{if .Team.CanCreateOrgRepo}}
|
|
<br><br>{{.i18n.Tr "org.teams.create_repo_permission_desc" | Str2html}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{if .IsOrganizationOwner}}
|
|
<div class="ui bottom attached segment">
|
|
<a class="ui teal small button" href="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}/edit">{{svg "octicon-gear"}} {{$.i18n.Tr "org.teams.settings"}}</a>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
<div class="ui small basic delete modal" id="leave-team-sidebar">
|
|
<div class="ui icon header">
|
|
{{svg "octicon-x" 16 "close inside"}}
|
|
{{$.i18n.Tr "org.teams.leave"}}
|
|
</div>
|
|
<div class="content">
|
|
<p>{{$.i18n.Tr "org.teams.leave.detail" `<span class="name"></span>` | Safe}}</p>
|
|
</div>
|
|
{{template "base/delete_modal_actions" .}}
|
|
</div>
|