Browse Source

fix(org): get right link href for file links

The following links should work well as external links in orgmode.
[[file:/Users/ll/Downloads/test.pdf]]
[[file:/Users/ll/Downloads/test.pdf][a pdf]]
leizhe 3 years ago
parent
commit
7e54abadca
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/main/frontend/components/block.cljs

+ 3 - 1
src/main/frontend/components/block.cljs

@@ -126,7 +126,9 @@
   [url]
   (match url
     ["File" s]
-    (string/replace s "file://" "")
+    (-> (string/replace s "file://" "")
+        ;; "file:/Users/ll/Downloads/test.pdf" is a normal org file link
+        (string/replace "file:" ""))
 
     ["Complex" m]
     (let [{:keys [link protocol]} m]