Browse Source

fix: assets url wrong path

Tienson Qin 2 years ago
parent
commit
1db40cfd5d
1 changed files with 10 additions and 4 deletions
  1. 10 4
      src/main/frontend/components/block.cljs

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

@@ -712,9 +712,15 @@
 (rum/defc asset-reference
 (rum/defc asset-reference
   [config title path]
   [config title path]
   (let [repo (state/get-current-repo)
   (let [repo (state/get-current-repo)
-        real-path-url (if (util/absolute-path? path)
-                    path
-                    (assets-handler/resolve-asset-real-path-url repo path))
+        real-path-url (cond
+                        (gp-util/url? path)
+                        path
+
+                        (util/absolute-path? path)
+                        path
+
+                        :else
+                        (assets-handler/resolve-asset-real-path-url repo path))
         ext-name (util/get-file-ext path)
         ext-name (util/get-file-ext path)
         title-or-path (cond
         title-or-path (cond
                         (string? title)
                         (string? title)
@@ -949,7 +955,7 @@
 (defn- render-macro
 (defn- render-macro
   [config name arguments macro-content format]
   [config name arguments macro-content format]
   [:div.macro {:data-macro-name name}
   [:div.macro {:data-macro-name name}
-   
+
    (if macro-content
    (if macro-content
      (let [ast (->> (mldoc/->edn macro-content (gp-mldoc/default-config format))
      (let [ast (->> (mldoc/->edn macro-content (gp-mldoc/default-config format))
                     (map first))
                     (map first))