Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve plain text comparison in data snapshot https://github.com/siyuan-note/siyuan/issues/13046

Danielf9f16cd3bb18
diff --git a/kernel/model/repository.go b/kernel/model/repository.go
index aa8f3ec755..d5cc82a607 100644
--- a/kernel/model/repository.go
+++ b/kernel/model/repository.go
@@ -151,8 +151,7 @@ func OpenRepoSnapshotDoc(fileID string) (title, content string, displayInText bo
}
} else {
displayInText = true
- title = path.Base(file.Path)
-
+ title = file.Path
if mimeType := mime.TypeByExtension(filepath.Ext(file.Path)); strings.HasPrefix(mimeType, "text/") || strings.Contains(mimeType, "json") {
// 如果是文本文件,直接返回文本内容
// All plain text formats are supported when comparing data snapshots https://github.com/siyuan-note/siyuan/issues/12975
diff --git a/kernel/util/working.go b/kernel/util/working.go
index 6c5963b30b..703379b4f9 100644
--- a/kernel/util/working.go
+++ b/kernel/util/working.go
@@ -433,6 +433,9 @@ func initMime() {
// 文档数据文件
mime.AddExtensionType(".sy", "application/json")
+
+ mime.AddExtensionType(".md", "text/markdown")
+ mime.AddExtensionType(".markdown", "text/markdown")
}
func GetDataAssetsAbsPath() (ret string) {