From 07a4de0a63e8c572ae8f362a8597a122122cbccc Mon Sep 17 00:00:00 2001 From: Julien Loir Date: Tue, 29 Dec 2020 19:14:34 +0100 Subject: [PATCH] Change default behavior of detectType method --- files/file.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/files/file.go b/files/file.go index 07bc135f..b71ce7a5 100644 --- a/files/file.go +++ b/files/file.go @@ -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