compatible with commit 33db791

This commit is contained in:
Mega Yu
2026-01-27 21:14:02 +08:00
parent 3c42733932
commit f4fb3d96b1
2 changed files with 11 additions and 5 deletions

View File

@@ -370,7 +370,7 @@
[e block href]
(let [href (if-let [url (:logseq.property.asset/external-url block)]
(if (string/starts-with? url "zotero://")
(pdf-assets/get-zotero-local-pdf-path (:logseq.property.asset/external-file-name block))
(pdf-assets/get-zotero-local-pdf-path (:logseq.property.asset/external-file-name block) :id (last (string/split url #"/")))
url)
href)]
(when-let [s (or href (some-> (.-target e) (.-dataset) (.-href)))]

View File

@@ -199,14 +199,20 @@
:owner-window (pdf-windows/resolve-own-window viewer)))))
(defn get-zotero-local-pdf-path
[path]
[path & {:keys [id]}]
(let [zotero-config (get-in (state/sub-config) [:zotero/settings-v2 "default"])
zotero-data-directory (:zotero-data-directory zotero-config)
zotero-linked-attachment-base-directory (:zotero-linked-attachment-base-directory zotero-config)
relative-path (subs path 14)]
(if (string/starts-with? path "zotero-link://")
(str zotero-linked-attachment-base-directory "/" relative-path)
(str zotero-data-directory "/storage/" relative-path))))
(cond
(string/starts-with? path "zotero-link://")
(str "file://" (util/node-path.join zotero-linked-attachment-base-directory relative-path))
(string/starts-with? path "zotero-path://")
(str "file://" (util/node-path.join zotero-data-directory "storage" relative-path))
:else ;; compatible with commit 33db791
(str "file://" (util/node-path.join zotero-data-directory "storage" id path)))))
(defn db-based-open-block-ref!
[block]