Change default behavior of detectType method
This commit is contained in:
parent
5509ea9424
commit
07a4de0a63
@ -163,10 +163,7 @@ func (i *FileInfo) detectType(modify, saveContent bool) error {
|
|||||||
case strings.HasPrefix(mimetype, "image"):
|
case strings.HasPrefix(mimetype, "image"):
|
||||||
i.Type = "image"
|
i.Type = "image"
|
||||||
return nil
|
return nil
|
||||||
case (len(buffer) > 0 && isBinary(buffer)) || i.Size > 10*1024*1024: // 10 MB
|
case strings.HasPrefix(mimetype, "text"):
|
||||||
i.Type = "blob"
|
|
||||||
return nil
|
|
||||||
default:
|
|
||||||
i.Type = "text"
|
i.Type = "text"
|
||||||
|
|
||||||
if !modify {
|
if !modify {
|
||||||
@ -182,6 +179,9 @@ func (i *FileInfo) detectType(modify, saveContent bool) error {
|
|||||||
|
|
||||||
i.Content = string(content)
|
i.Content = string(content)
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
i.Type = "blob"
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user