1
0

Fix CSV errors for rendering (#514)

هذا الالتزام موجود في:
Thomas Miceli
2025-09-29 19:02:33 +02:00
ملتزم من قبل GitHub
الأصل 92c5569538
التزام 5ef5518795
7 ملفات معدلة مع 21 إضافات و15 حذوفات

عرض الملف

@@ -15,8 +15,8 @@ type CSVFile struct {
Rows [][]string `json:"-"`
}
func (r CSVFile) getFile() *git.File {
return r.File
func (r CSVFile) InternalType() string {
return "CSVFile"
}
func renderCsvFile(file *git.File) (*CSVFile, error) {

عرض الملف

@@ -21,8 +21,8 @@ type HighlightedFile struct {
HTML string `json:"-"`
}
func (r HighlightedFile) getFile() *git.File {
return r.File
func (r HighlightedFile) InternalType() string {
return "HighlightedFile"
}
type RenderedGist struct {

عرض الملف

@@ -9,7 +9,7 @@ import (
)
type RenderedFile interface {
getFile() *git.File
InternalType() string
}
type NonHighlightedFile struct {
@@ -17,8 +17,8 @@ type NonHighlightedFile struct {
Type string `json:"type"`
}
func (r NonHighlightedFile) getFile() *git.File {
return r.File
func (r NonHighlightedFile) InternalType() string {
return "NonHighlightedFile"
}
func RenderFiles(files []*git.File) []RenderedFile {
@@ -54,7 +54,11 @@ func processFile(file *git.File) RenderedFile {
if mt.IsCSV() {
rendered, err := renderCsvFile(file)
if err != nil {
log.Error().Err(err).Msg("Error parsing CSV file for " + file.Filename)
rendered, err := highlightFile(file)
if err != nil {
log.Error().Err(err).Msg("Error rendering gist preview for " + file.Filename)
}
return rendered
}
return rendered
} else if mt.IsText() && filepath.Ext(file.Filename) == ".md" {