]> source.dussan.org Git - gitea.git/commit
Properly determine CSV delimiter (#17459)
authorRichard Mahn <richmahn@users.noreply.github.com>
Sat, 30 Oct 2021 15:50:40 +0000 (09:50 -0600)
committerGitHub <noreply@github.com>
Sat, 30 Oct 2021 15:50:40 +0000 (23:50 +0800)
commit40c8451b7d68614cc5d971cd148df503e7c00647
tree83ce2c66ea9909decb692b3d4a5cf7c8ce2c6f10
parent63c0dc89ef96a2e38b38aa6cba5e4e8d1d7b9150
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>
modules/csv/csv.go
modules/csv/csv_test.go
modules/markup/csv/csv.go
routers/web/repo/compare.go
services/gitdiff/csv_test.go