aboutsummaryrefslogtreecommitdiffstats
path: root/modules/markup/csv
diff options
context:
space:
mode:
authorRichard Mahn <richmahn@users.noreply.github.com>2021-10-30 09:50:40 -0600
committerGitHub <noreply@github.com>2021-10-30 23:50:40 +0800
commit40c8451b7d68614cc5d971cd148df503e7c00647 (patch)
tree83ce2c66ea9909decb692b3d4a5cf7c8ce2c6f10 /modules/markup/csv
parent63c0dc89ef96a2e38b38aa6cba5e4e8d1d7b9150 (diff)
downloadgitea-40c8451b7d68614cc5d971cd148df503e7c00647.tar.gz
gitea-40c8451b7d68614cc5d971cd148df503e7c00647.zip
Properly determine CSV delimiter (#17459)
* Fixes #16558 CSV delimiter determiner * Fixes #16558 - properly determine CSV delmiiter * Moves quoteString to a new function * Adds big test with lots of commas for tab delimited csv * Adds comments * Shortens the text of the test * Removes single quotes from regexp as only double quotes need to be searched * Fixes spelling * Fixes check of length as it probalby will only be 1e4, not greater * Makes sample size a const, properly removes truncated line * Makes sample size a const, properly removes truncated line * Fixes comment * Fixes comment * tests for FormatError() function * Adds logic to find the limiter before or after a quoted value * Simplifies regex * Error tests * Error tests * Update modules/csv/csv.go Co-authored-by: delvh <dev.lh@web.de> * Update modules/csv/csv.go Co-authored-by: delvh <dev.lh@web.de> * Adds comments * Update modules/csv/csv.go Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'modules/markup/csv')
-rw-r--r--modules/markup/csv/csv.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/markup/csv/csv.go b/modules/markup/csv/csv.go
index e4b423d4f0..c1d9d18b67 100644
--- a/modules/markup/csv/csv.go
+++ b/modules/markup/csv/csv.go
@@ -102,7 +102,7 @@ func (Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.Wri
return err
}
- rd, err := csv.CreateReaderAndGuessDelimiter(bytes.NewReader(rawBytes))
+ rd, err := csv.CreateReaderAndDetermineDelimiter(ctx, bytes.NewReader(rawBytes))
if err != nil {
return err
}