Merge pull request #17 from LefsFlarey/issue/3666

Fixed 404 caused by unexpected question mark
This commit is contained in:
Matthias Loibl 2016-11-08 18:28:00 +01:00 committed by GitHub
commit 45c4539c61
3 changed files with 4 additions and 4 deletions

View File

@ -97,7 +97,7 @@ func NewFuncMap() []template.FuncMap {
"MD5": base.EncodeMD5, "MD5": base.EncodeMD5,
"ActionContent2Commits": ActionContent2Commits, "ActionContent2Commits": ActionContent2Commits,
"EscapePound": func(str string) string { "EscapePound": func(str string) string {
return strings.NewReplacer("%", "%25", "#", "%23", " ", "%20").Replace(str) return strings.NewReplacer("%", "%25", "#", "%23", " ", "%20", "?", "%3F").Replace(str)
}, },
"RenderCommitMessage": RenderCommitMessage, "RenderCommitMessage": RenderCommitMessage,
"ThemeColorMetaTag": func() string { "ThemeColorMetaTag": func() string {

View File

@ -264,7 +264,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
return return
} }
ctx.Redirect(ctx.Repo.RepoLink + "/src/" + branchName + "/" + form.TreePath) ctx.Redirect(ctx.Repo.RepoLink + "/src/" + branchName + "/" + strings.NewReplacer("%", "%25", "#", "%23", " ", "%20", "?", "%3F").Replace(form.TreePath))
} }
func EditFilePost(ctx *context.Context, form auth.EditRepoFileForm) { func EditFilePost(ctx *context.Context, form auth.EditRepoFileForm) {

View File

@ -54,9 +54,9 @@
{{.title}} {{.title}}
{{if and .IsRepositoryWriter (not .Repository.IsMirror)}} {{if and .IsRepositoryWriter (not .Repository.IsMirror)}}
<div class="ui right"> <div class="ui right">
<a class="ui small button" href="{{.RepoLink}}/wiki/{{.PageURL}}/_edit">{{.i18n.Tr "repo.wiki.edit_page_button"}}</a> <a class="ui small button" href="{{.RepoLink}}/wiki/{{EscapePound .PageURL}}/_edit">{{.i18n.Tr "repo.wiki.edit_page_button"}}</a>
<a class="ui green small button" href="{{.RepoLink}}/wiki/_new">{{.i18n.Tr "repo.wiki.new_page_button"}}</a> <a class="ui green small button" href="{{.RepoLink}}/wiki/_new">{{.i18n.Tr "repo.wiki.new_page_button"}}</a>
<a class="ui red small button delete-button" href="" data-url="{{.RepoLink}}/wiki/{{.PageURL}}/delete" data-id="{{.PageURL}}">{{.i18n.Tr "repo.wiki.delete_page_button"}}</a> <a class="ui red small button delete-button" href="" data-url="{{.RepoLink}}/wiki/{{EscapePound .PageURL}}/delete" data-id="{{EscapePound .PageURL}}">{{.i18n.Tr "repo.wiki.delete_page_button"}}</a>
</div> </div>
{{end}} {{end}}
<div class="ui sub header"> <div class="ui sub header">