Fixed 404 caused by unexpected question mark

This fixes 404 caused when creating new files or wiki pages with question marks. Amended to force CI rebuild
tokarchuk/v1.17
Flare 8 years ago
parent 7e15ff9486
commit 01c5233b53
No known key found for this signature in database
GPG Key ID: 762EE3D369C1A772
  1. 2
      modules/template/template.go
  2. 2
      routers/repo/editor.go
  3. 4
      templates/repo/wiki/view.tmpl

@ -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 {

@ -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) {

@ -48,9 +48,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">

Loading…
Cancel
Save