diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2021-10-24 23:12:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-24 22:12:43 +0100 |
commit | f99d50fc9f8baf406f32a491b214f8a13617d086 (patch) | |
tree | b3cd8a1304e522f111690e9f68130e663012bb16 /modules/csv | |
parent | 932780c2bbae09f052e2fcd1a0701966483496e8 (diff) | |
download | gitea-f99d50fc9f8baf406f32a491b214f8a13617d086.tar.gz gitea-f99d50fc9f8baf406f32a491b214f8a13617d086.zip |
Read expected buffer size (#17409)
* Read expected buffer size.
* Changed name.
Diffstat (limited to 'modules/csv')
-rw-r--r-- | modules/csv/csv.go | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/modules/csv/csv.go b/modules/csv/csv.go index 30698830a4..2e2611aa81 100644 --- a/modules/csv/csv.go +++ b/modules/csv/csv.go @@ -29,11 +29,8 @@ func CreateReader(input io.Reader, delimiter rune) *stdcsv.Reader { // CreateReaderAndGuessDelimiter tries to guess the field delimiter from the content and creates a csv.Reader. func CreateReaderAndGuessDelimiter(rd io.Reader) (*stdcsv.Reader, error) { var data = make([]byte, 1e4) - size, err := rd.Read(data) + size, err := util.ReadAtMost(rd, data) if err != nil { - if err == io.EOF { - return CreateReader(bytes.NewReader([]byte{}), rune(',')), nil - } return nil, err } |