Change default behavior of detectType method

This commit is contained in:
Julien Loir 2020-12-29 19:14:34 +01:00
parent 5509ea9424
commit 07a4de0a63

View File

@ -163,10 +163,7 @@ func (i *FileInfo) detectType(modify, saveContent bool) error {
case strings.HasPrefix(mimetype, "image"):
i.Type = "image"
return nil
case (len(buffer) > 0 && isBinary(buffer)) || i.Size > 10*1024*1024: // 10 MB
i.Type = "blob"
return nil
default:
case strings.HasPrefix(mimetype, "text"):
i.Type = "text"
if !modify {
@ -182,6 +179,9 @@ func (i *FileInfo) detectType(modify, saveContent bool) error {
i.Content = string(content)
}
default:
i.Type = "blob"
return nil
}
return nil