Skip to content

Commit

Permalink
Backport of go-gitea#17018: Prevent NPE in CSV diff rendering when co…
Browse files Browse the repository at this point in the history
…lumn removed

Fixes go-gitea#16837 if a column is deleted.
  • Loading branch information
richmahn committed Oct 20, 2021
1 parent eb748ff commit 3c97c48
Show file tree
Hide file tree
Showing 7 changed files with 351 additions and 136 deletions.
3 changes: 3 additions & 0 deletions modules/csv/csv.go
Expand Up @@ -32,6 +32,9 @@ func CreateReaderAndGuessDelimiter(rd io.Reader) (*stdcsv.Reader, error) {
var data = make([]byte, 1e4)
size, err := rd.Read(data)
if err != nil {
if err == io.EOF {
return CreateReader(bytes.NewReader([]byte{}), rune(',')), nil
}
return nil, err
}

Expand Down

0 comments on commit 3c97c48

Please sign in to comment.