summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author无闻 <u@gogs.io>2015-07-28 17:46:58 +0800
committer无闻 <u@gogs.io>2015-07-28 17:46:58 +0800
commit678700b74d1a091c34849d17ade78e2903c08bc9 (patch)
treecad8b6813088aecabeed54c1abcaac2c7b847b60
parenteda9211fa49ac3e5b8f2b772413abc7861fca0cd (diff)
parent167265d533db2b7da1ea9e1a0f098d6e0d255183 (diff)
downloadgitea-678700b74d1a091c34849d17ade78e2903c08bc9.tar.gz
gitea-678700b74d1a091c34849d17ade78e2903c08bc9.zip
Merge pull request #1402 from wqweto/develop
Allow file and directory names to contain percent character
-rw-r--r--modules/base/template.go2
-rw-r--r--templates/repo/home.tmpl2
-rw-r--r--templates/repo/view_list.tmpl4
3 files changed, 4 insertions, 4 deletions
diff --git a/modules/base/template.go b/modules/base/template.go
index bc69bb3b37..f0a2e0329c 100644
--- a/modules/base/template.go
+++ b/modules/base/template.go
@@ -178,7 +178,7 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
"Oauth2Name": Oauth2Name,
"ToUtf8": ToUtf8,
"EscapePound": func(str string) string {
- return strings.Replace(str, "#", "%23", -1)
+ return strings.Replace(strings.Replace(str, "%", "%25", -1), "#", "%23", -1)
},
"RenderCommitMessage": RenderCommitMessage,
}
diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl
index 2cc114edcf..7a18ed985d 100644
--- a/templates/repo/home.tmpl
+++ b/templates/repo/home.tmpl
@@ -48,7 +48,7 @@
{{ $l := Subtract $n 1}}
{{range $i, $v := .Treenames}}
{{if eq $i $l}}
- <span class="bread">{{EscapePound $v}}</span>
+ <span class="bread">{{$v}}</span>
{{else}}
<span class="bread"><a href="{{EscapePound $.BranchLink}}/{{index $.Paths $i}}">{{$v}}</a></span>
{{end}}
diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl
index f51c10025a..d3303193f8 100644
--- a/templates/repo/view_list.tmpl
+++ b/templates/repo/view_list.tmpl
@@ -50,7 +50,7 @@
<span class="octicon octicon-file-{{if or $entry.IsDir}}directory{{else}}text{{end}}"></span>
</td>
<td class="name">
- <a href="{{EscapePound $.BranchLink}}/{{$.TreePath}}{{$entry.Name}}" class="text-truncate">{{$entry.Name}}</a>
+ <a href="{{EscapePound $.BranchLink}}/{{EscapePound $.TreePath}}{{EscapePound $entry.Name}}" class="text-truncate">{{$entry.Name}}</a>
</td>
{{end}}
<td class="sha">
@@ -66,4 +66,4 @@
</table>
{{if .ReadmeExist}}
{{template "repo/view_file" .}}
-{{end}} \ No newline at end of file
+{{end}}