mirror of
https://github.com/go-gitea/gitea
synced 2024-11-15 14:31:41 +01:00
add ctx.HTMLString
This commit is contained in:
parent
110bc5d7ad
commit
7e40149415
2 changed files with 8 additions and 1 deletions
|
@ -420,7 +420,7 @@ func DiffPreviewPost(ctx *context.Context) {
|
|||
}
|
||||
|
||||
if diff.NumFiles == 0 {
|
||||
ctx.PlainText(http.StatusOK, `<div class="tw-p-6">`+ctx.Locale.TrString("repo.editor.no_changes_to_show")+`</div>`)
|
||||
ctx.HTMLString(http.StatusOK, `<div class="tw-p-6">`+ctx.Locale.TrString("repo.editor.no_changes_to_show")+`</div>`)
|
||||
return
|
||||
}
|
||||
ctx.Data["File"] = diff.Files[0]
|
||||
|
|
|
@ -137,6 +137,13 @@ func (b *Base) JSON(status int, content any) {
|
|||
}
|
||||
}
|
||||
|
||||
// JSON render content as JSON
|
||||
func (b *Base) HTMLString(status int, html string) {
|
||||
b.Resp.Header().Set("Content-Type", "text/html;charset=utf-8")
|
||||
b.Resp.WriteHeader(status);
|
||||
b.Resp.Write([]byte(html))
|
||||
}
|
||||
|
||||
// RemoteAddr returns the client machine ip address
|
||||
func (b *Base) RemoteAddr() string {
|
||||
return b.Req.RemoteAddr
|
||||
|
|
Loading…
Reference in a new issue