From 53d3582cc9ae19e230dcbb76a25a00f62b4ab477 Mon Sep 17 00:00:00 2001 From: Henrique Pimentel <66185935+HenriquerPimentel@users.noreply.github.com> Date: Wed, 10 Apr 2024 15:01:00 +0100 Subject: [PATCH] Fix row numbering Co-authored-by: Lunny Xiao --- modules/markup/csv/csv.go | 2 +- modules/markup/csv/csv_test.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/markup/csv/csv.go b/modules/markup/csv/csv.go index 0ec75be43767f..8c80683a3b028 100644 --- a/modules/markup/csv/csv.go +++ b/modules/markup/csv/csv.go @@ -97,7 +97,7 @@ func (r Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.W return err } - row := 1 + row := 0 for { fields, err := rd.Read() if err == io.EOF || (row >= maxRows && maxRows != 0) { diff --git a/modules/markup/csv/csv_test.go b/modules/markup/csv/csv_test.go index 8c07184b21eeb..a194f11247d52 100644 --- a/modules/markup/csv/csv_test.go +++ b/modules/markup/csv/csv_test.go @@ -16,10 +16,10 @@ import ( func TestRenderCSV(t *testing.T) { var render Renderer kases := map[string]string{ - "a": "
1a
", - "1,2": "
112
", - "1;2\n3;4": "
112
234
", - "
": "
1<br/>
", + "a": "
0a
", + "1,2": "
012
", + "1;2\n3;4": "
012
234
", + "
": "
0<br/>
", } for k, v := range kases {