Browse Source

fix: zotero attachment link

Tienson Qin 4 years ago
parent
commit
53ae165f7c
1 changed files with 8 additions and 9 deletions
  1. 8 9
      src/main/frontend/extensions/zotero/extractor.cljs

+ 8 - 9
src/main/frontend/extensions/zotero/extractor.cljs

@@ -138,16 +138,15 @@
 
 (defmethod extract "attachment"
   [item]
-  (let [{:keys [title url link-mode path]} (-> item :data)]
-    (case link-mode
-      "imported_file"
-      (markdown-link title (local-link item))
-      "imported_url"
-      (markdown-link title url)
-      "linked_file"
-      (markdown-link title (str "file://" path))
-      "linked_url"
+  (let [{:keys [title filename url link-mode path]} (-> item :data)]
+    (cond
+      (contains? #{"imported_file" "imported_url" "linked_file"} link-mode)
+      (markdown-link (or title filename) (local-link item))
+
+      (some? url)
       (markdown-link title url)
+
+      :else
       nil)))
 
 (defmethod extract :default