mirror of https://github.com/gogs/gogs.git
routes/repo/issue: fix redirect with unexpected escape (#5443)
parent
0d66b1cc1c
commit
a221b2807f
|
@ -138,6 +138,11 @@ func (c *Context) JSONSuccess(data interface{}) {
|
||||||
c.JSON(http.StatusOK, data)
|
c.JSON(http.StatusOK, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RawRedirect simply calls underlying Redirect method with no escape.
|
||||||
|
func (c *Context) RawRedirect(location string, status ...int) {
|
||||||
|
c.Context.Redirect(location, status...)
|
||||||
|
}
|
||||||
|
|
||||||
// Redirect responses redirection wtih given location and status.
|
// Redirect responses redirection wtih given location and status.
|
||||||
// It escapes special characters in the location string.
|
// It escapes special characters in the location string.
|
||||||
func (c *Context) Redirect(location string, status ...int) {
|
func (c *Context) Redirect(location string, status ...int) {
|
||||||
|
|
|
@ -901,7 +901,7 @@ func NewComment(c *context.Context, f form.CreateComment) {
|
||||||
typeName = "pulls"
|
typeName = "pulls"
|
||||||
}
|
}
|
||||||
if comment != nil {
|
if comment != nil {
|
||||||
c.Redirect(fmt.Sprintf("%s/%s/%d#%s", c.Repo.RepoLink, typeName, issue.Index, comment.HashTag()))
|
c.RawRedirect(fmt.Sprintf("%s/%s/%d#%s", c.Repo.RepoLink, typeName, issue.Index, comment.HashTag()))
|
||||||
} else {
|
} else {
|
||||||
c.Redirect(fmt.Sprintf("%s/%s/%d", c.Repo.RepoLink, typeName, issue.Index))
|
c.Redirect(fmt.Sprintf("%s/%s/%d", c.Repo.RepoLink, typeName, issue.Index))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue