Ver Fonte

fix(pdf): `file://` asset link not working on Win32

charlie há 4 anos atrás
pai
commit
2f9bc7bf86

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

@@ -439,7 +439,7 @@
 (rum/defc asset-reference
   [config title path]
   (let [repo-path (config/get-repo-dir (state/get-current-repo))
-        full-path (if (= \/ (first path))
+        full-path (if (util/absolute-path? path)
                     path
                     (.. util/node-path (join repo-path (config/get-local-asset-absolute-path path))))
         ext-name (util/get-file-ext full-path)

+ 1 - 1
src/main/frontend/extensions/pdf/assets.cljs

@@ -21,7 +21,7 @@
   [full-path]
   (let [filename (util/node-path.basename full-path)
         url (cond
-              (string/starts-with? full-path "/")
+              (util/absolute-path? full-path)
               (str "file://" full-path)
 
               (string/starts-with? full-path "file:/")

+ 1 - 1
src/main/frontend/util.cljc

@@ -1001,7 +1001,7 @@
      (try
        (js/window.apis.isAbsolutePath path)
        (catch js/Error _
-         (node-path.isAbsolute path)))))
+         (utils/win32 path)))))
 
 (defn ->system-modifier
   [keyboard-shortcut]