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: https://github.com/siyuan-note/siyuan/issues/17785
Daniel457bd9b2de49
diff --git a/kernel/api/asset.go b/kernel/api/asset.goindex 5facd76969..78248296fb 100644--- a/kernel/api/asset.go+++ b/kernel/api/asset.go@@ -234,7 +234,12 @@ func getDocAssets(c *gin.Context) {}id := arg["id"].(string)- assets, err := model.DocAssets(id)+ retainQueryStr := true+ if nil != arg["retainQueryStr"] {+ retainQueryStr = arg["retainQueryStr"].(bool)+ }++ assets, err := model.DocAssets(id, retainQueryStr)if err != nil {ret.Code = -1ret.Msg = err.Error()diff --git a/kernel/model/assets.go b/kernel/model/assets.goindex 50b9d50634..12ea5335ca 100644--- a/kernel/model/assets.go+++ b/kernel/model/assets.go@@ -216,13 +216,20 @@ func DocImageAssets(rootID string) (ret []string, err error) {return}-func DocAssets(rootID string) (ret []string, err error) {+func DocAssets(rootID string, retainQueryStr bool) (ret []string, err error) {tree, err := LoadTreeByBlockID(rootID)if err != nil {return}ret = getAssetsLinkDests(tree.Root, false)+ if !retainQueryStr {+ for i, asset := range ret {+ if idx := strings.Index(asset, "?"); idx >= 0 {+ ret[i] = asset[:idx]+ }+ }+ }return}diff --git a/kernel/model/publish_access.go b/kernel/model/publish_access.goindex af52407387..0651ec8b30 100644--- a/kernel/model/publish_access.go+++ b/kernel/model/publish_access.go@@ -274,7 +274,7 @@ func CheckAbsPathAccessableByPublishAccess(c *gin.Context, absPath string, publifor _, bt := range bts {passwordID, password := GetPathPasswordByPublishAccess(bt.BoxID, bt.Path, publishAccess)if CheckPathAccessableByPublishIgnore(bt.BoxID, bt.Path, publishIgnore) && (password == "" || CheckPublishAuthCookie(c, passwordID, password)) {- assets, _ := DocAssets(bt.ID)+ assets, _ := DocAssets(bt.ID, false)for _, assetPath := range assets {if assetPath == relPath {return true@@ -836,7 +836,7 @@ func FilterAssetContentByPublishAccess(c *gin.Context, publishAccess PublishAccefor _, bt := range bts {passwordID, password := GetPathPasswordByPublishAccess(bt.BoxID, bt.Path, publishAccess)if CheckPathAccessableByPublishIgnore(bt.BoxID, bt.Path, publishIgnore) && (password == "" || CheckPublishAuthCookie(c, passwordID, password)) {- assets, err := DocAssets(bt.ID)+ assets, err := DocAssets(bt.ID, false)if err == nil {validAssets = append(validAssets, assets...)}