Skip to content

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

:art: Clean code https://github.com/siyuan-note/siyuan/pull/6380

Liang Ding0bc997051e54
diff --git a/kernel/api/snippet.go b/kernel/api/snippet.go
index 2b7402fad9..1b1713fdd2 100644
--- a/kernel/api/snippet.go
+++ b/kernel/api/snippet.go
@@ -41,7 +41,7 @@ func serveSnippets(c *gin.Context) {
c.Status(404)
return
}
-
+
for _, s := range confSnippets {
if s.Name == name && ("" != ext && s.Type == ext[1:]) {
c.Header("Content-Type", mime.TypeByExtension(ext))
@@ -49,6 +49,8 @@ func serveSnippets(c *gin.Context) {
return
}
}
+
+ // 没有在配置文件中命中时在文件系统上查找
filePath = filepath.Join(util.SnippetsPath, filePath)
c.File(filePath)
}
diff --git a/kernel/util/working.go b/kernel/util/working.go
index 623597dca8..7b06612094 100644
--- a/kernel/util/working.go
+++ b/kernel/util/working.go
@@ -172,7 +172,7 @@ var (
AppearancePath string // 配置目录下的外观目录 appearance/ 路径
ThemesPath string // 配置目录下的外观目录下的 themes/ 路径
IconsPath string // 配置目录下的外观目录下的 icons/ 路径
- SnippetsPath string // 数据目录下的 snippets/ 路径
+ SnippetsPath string // 数据目录下的 snippets/ 路径
AndroidNativeLibDir string // Android 库路径
AndroidPrivateDataDir string // Android 私有数据路径