summaryrefslogtreecommitdiffstats
path: root/modules/markup
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2024-03-08 17:13:58 +0800
committerGitHub <noreply@github.com>2024-03-08 09:13:58 +0000
commit6651d2d87aa4af96bf2c992e3ecae6a290d07496 (patch)
tree7fa2ff4cf820fe280f15c5547ce55352b65d9737 /modules/markup
parent76b6754c3a42e6f1d675fe9f9d66a65954cb85d1 (diff)
downloadgitea-6651d2d87aa4af96bf2c992e3ecae6a290d07496.tar.gz
gitea-6651d2d87aa4af96bf2c992e3ecae6a290d07496.zip
Fix incorrect rendering csv file when file size is larger than UI.CSV.MaxFileSize (#29653) (#29663)
Backport #29653 by @yp05327 Fix #29506 Co-authored-by: yp05327 <576951401@qq.com>
Diffstat (limited to 'modules/markup')
-rw-r--r--modules/markup/csv/csv.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/markup/csv/csv.go b/modules/markup/csv/csv.go
index 7af34a6cbc..12458e954a 100644
--- a/modules/markup/csv/csv.go
+++ b/modules/markup/csv/csv.go
@@ -93,8 +93,10 @@ func (Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.Wri
if _, err := tmpBlock.WriteString(html.EscapeString(string(rawBytes))); err != nil {
return err
}
- _, err = tmpBlock.WriteString("</pre>")
- return err
+ if _, err := tmpBlock.WriteString("</pre>"); err != nil {
+ return err
+ }
+ return tmpBlock.Flush()
}
rd, err := csv.CreateReaderAndDetermineDelimiter(ctx, bytes.NewReader(rawBytes))