3
0

Fix record import via some CSV files

Some CSV files failed to detect as text/csv so the import failed.
ref: https://github.com/gabriel-vasile/mimetype/issues/138
This commit is contained in:
Tomaž Jerman
2021-01-15 12:12:01 +01:00
parent 2eea2ad908
commit ce21db2197
3 changed files with 11 additions and 4 deletions

View File

@@ -39,6 +39,10 @@ func (y *decoder) CanDecodeFile(f io.Reader) bool {
return y.CanDecodeExt(ext)
}
func (y *decoder) CanDecodeMime(m string) bool {
return m == "text/csv"
}
func (y *decoder) CanDecodeExt(ext string) bool {
pt := strings.Split(ext, ".")
return strings.TrimSpace(pt[len(pt)-1]) == "csv"