An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Improve mime type detect
Daniel3ffc32d08939
diff --git a/kernel/util/file.go b/kernel/util/file.goindex 1193700aa6..832d1e225a 100644--- a/kernel/util/file.go+++ b/kernel/util/file.go@@ -78,7 +78,13 @@ func GetUniqueFilename(filePath string) string {func GetMimeTypeByExt(filePath string) (ret string) {ret = mime.TypeByExtension(filepath.Ext(filePath))if "" == ret {- m, err := mimetype.DetectFile(filePath)+ f, err := filelock.OpenFile(filePath, os.O_RDONLY, 0644)+ if err != nil {+ logging.LogErrorf("open file [%s] failed: %s", filePath, err)+ return+ }+ defer filelock.CloseFile(f)+ m, err := mimetype.DetectReader(f)if err != nil {logging.LogErrorf("detect mime type of [%s] failed: %s", filePath, err)return