fixes
This commit is contained in:
1 parent
c347d2418f
commit
1ad180a052
49 files changed
+6339
-89
No files matched your search
@@ -134,6 +134,20 @@ func (s *Service) ExtractSchema(ctx context.Context, companyID, feedID uuid.UUID
|
||||
preview = preview[:4096]
|
||||
}
|
||||
out.Preview = string(preview)
|
||||
case "excel":
|
||||
// Workbooks need the whole file (zip/OLE directory), so read from disk, not the sample.
|
||||
sheetCSV, err := excelSchemaCSV(f.Name(), excelSheetOption(feed), schemaMaxRows)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fields, rows, preview, err := extractCSVSchema(sheetCSV)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out.Fields = fields
|
||||
out.SampleRows = rows
|
||||
out.Preview = preview
|
||||
out.PreviewTruncated = false
|
||||
default:
|
||||
fields, rows, preview, err := extractCSVSchema(data)
|
||||
if err != nil {
|
||||
@@ -254,6 +268,9 @@ func guessXMLItemPath(data []byte) string {
|
||||
}
|
||||
}
|
||||
}
|
||||
if path := guessRepeatedXMLItemPath([]byte(sample)); path != "" {
|
||||
return path
|
||||
}
|
||||
return "rss/channel/item"
|
||||
}
|
||||
|
||||
@@ -302,7 +319,8 @@ func extractXMLSchema(data []byte, itemLocal string) ([]SchemaField, int, error)
|
||||
accumulateRowFields(acc, row)
|
||||
return nil
|
||||
})
|
||||
if err != nil && !errors.Is(err, errStopSchema) {
|
||||
// The preview window cuts large feeds mid-record; rows read before the cut count.
|
||||
if err != nil && !errors.Is(err, errStopSchema) && !(rows > 0 && strings.Contains(err.Error(), "unexpected EOF")) {
|
||||
return nil, rows, err
|
||||
}
|
||||
return finalizeSchema(acc), rows, nil
|
||||
|
||||
Reference in new issue
Block a user