File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -420,7 +420,7 @@ func DiffPreviewPost(ctx *context.Context) {
420
420
}
421
421
422
422
if diff .NumFiles == 0 {
423
- ctx .PlainText (http .StatusOK , `<div class="tw-p-6">` + ctx .Locale .TrString ("repo.editor.no_changes_to_show" )+ `</div>` )
423
+ ctx .HTMLString (http .StatusOK , `<div class="tw-p-6">` + ctx .Locale .TrString ("repo.editor.no_changes_to_show" )+ `</div>` )
424
424
return
425
425
}
426
426
ctx .Data ["File" ] = diff .Files [0 ]
Original file line number Diff line number Diff line change @@ -137,6 +137,13 @@ func (b *Base) JSON(status int, content any) {
137
137
}
138
138
}
139
139
140
+ // JSON render content as JSON
141
+ func (b * Base ) HTMLString (status int , html string ) {
142
+ b .Resp .Header ().Set ("Content-Type" , "text/html;charset=utf-8" )
143
+ b .Resp .WriteHeader (status );
144
+ b .Resp .Write ([]byte (html ))
145
+ }
146
+
140
147
// RemoteAddr returns the client machine ip address
141
148
func (b * Base ) RemoteAddr () string {
142
149
return b .Req .RemoteAddr
You can’t perform that action at this time.
0 commit comments