]> source.dussan.org Git - gitea.git/commitdiff
Fix incorrect rendering csv file when file size is larger than UI.CSV.MaxFileSize...
authorGiteabot <teabot@gitea.io>
Fri, 8 Mar 2024 09:13:58 +0000 (17:13 +0800)
committerGitHub <noreply@github.com>
Fri, 8 Mar 2024 09:13:58 +0000 (09:13 +0000)
Backport #29653 by @yp05327

Fix #29506

Co-authored-by: yp05327 <576951401@qq.com>
modules/markup/csv/csv.go

index 7af34a6cbc2d493154da2b5fc9a0f64c8d39fc08..12458e954ade9d52443586813de5481b14ffa4e0 100644 (file)
@@ -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))