fixup func isBinary to handle CJK runes correctly

This commit is contained in:
荒野無燈 committed 2019-05-08 02:15:37 +08:00
1 parent 805ad33c1b
commit 1c42539522
2 files changed
+39 -5

No files matched your search

+1 -1
View File
@@ -164,7 +164,7 @@ func (i *FileInfo) detectType(modify, saveContent bool) error {
case strings.HasPrefix(mimetype, "image"):
i.Type = "image"
return nil
case isBinary(string(buffer[:n])) || i.Size > 10*1024*1024: // 10 MB
case isBinary(buffer[:n], n) || i.Size > 10*1024*1024: // 10 MB
i.Type = "blob"
return nil
default: