Skip to content

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

:art: Supports local shorthands on Android https://github.com/siyuan-note/siyuan/issues/14414

Danielf2654be837df
diff --git a/kernel/model/shortcuts.go b/kernel/model/shortcuts.go
index 5778fd9778..9bcc81fbe6 100644
--- a/kernel/model/shortcuts.go
+++ b/kernel/model/shortcuts.go
@@ -41,9 +41,28 @@ func MoveLocalShorthands(boxID, hPath, parentID, id string) (retID string, err e
buff := bytes.Buffer{}
var toRemoves []string
+ assetsDir := filepath.Join(util.DataDir, "assets")
for _, entry := range entries {
if entry.IsDir() {
- continue
+ if "assets" == entry.Name() {
+ assetsEntries, readErr := os.ReadDir(filepath.Join(shorthandsDir, entry.Name()))
+ if nil != readErr {
+ logging.LogErrorf("read dir [%s] failed: %s", shorthandsDir, readErr)
+ continue
+ }
+ for _, assetEntry := range assetsEntries {
+ if assetEntry.IsDir() {
+ continue
+ }
+
+ p := filepath.Join(shorthandsDir, entry.Name(), assetEntry.Name())
+ assetWritePath := filepath.Join(assetsDir, assetEntry.Name())
+ if renameErr := os.Rename(p, assetWritePath); nil != renameErr {
+ logging.LogErrorf("rename file [%s] to [%s] failed: %s", p, assetWritePath, renameErr)
+ continue
+ }
+ }
+ }
}
if filepath.Ext(entry.Name()) != ".md" {