Browse Source

fix: can't open images with http links when publishing

Tienson Qin 4 years ago
parent
commit
58608653c8
1 changed files with 8 additions and 4 deletions
  1. 8 4
      src/main/frontend/components/block.cljs

+ 8 - 4
src/main/frontend/components/block.cljs

@@ -249,11 +249,15 @@
     (if (and (config/local-asset? href)
              (config/local-db? (state/get-current-repo)))
       (asset-link config title href label metadata full_text)
-      (let [href (if config/publishing?
+      (let [href (cond
+                   (util/starts-with? href "http")
+                   href
+
+                   config/publishing?
                    (subs href 1)
-                   (if (util/starts-with? href "http")
-                     href
-                     (get-file-absolute-path config href)))]
+
+                   :else
+                   (get-file-absolute-path config href))]
         (resizable-image config title href metadata full_text false)))))
 
 (defn repetition-to-string