mirror of
https://github.com/logseq/logseq.git
synced 2026-05-29 23:19:38 +00:00
fix(fs): windows unc path support
This commit is contained in:
@@ -69,7 +69,19 @@
|
||||
url (decode-protected-assets-schema-path url)
|
||||
path (string/replace url "assets://" "")
|
||||
path (js/decodeURIComponent path)]
|
||||
(callback #js {:path path}))))
|
||||
(cond (or (string/starts-with? path "/")
|
||||
(re-find #"(?i)^/[a-zA-Z]:" path))
|
||||
(callback #js {:path path})
|
||||
|
||||
;; assume winwdows unc path
|
||||
utils/win32?
|
||||
(do (logger/debug :resolve-assets-url url)
|
||||
(callback #js {:path (str "//" path)}))
|
||||
|
||||
:else
|
||||
(do
|
||||
(logger/warn ::resolve-assets-url "Unknown assets url" url)
|
||||
(callback #js {:path path}))))))
|
||||
|
||||
(.registerFileProtocol
|
||||
protocol FILE_LSP_SCHEME
|
||||
|
||||
@@ -76,8 +76,9 @@
|
||||
|
||||
(str "assets://" (string/replace rpath' (str "@" (:name alias)) (:dir alias)))
|
||||
|
||||
(if has-schema? (path/path-join graph-root rpath)
|
||||
(path/path-join "file://" graph-root rpath))))]
|
||||
(if has-schema?
|
||||
(path/path-join graph-root rpath)
|
||||
(path/prepend-protocol "file:" (path/path-join graph-root rpath)))))]
|
||||
(convert-platform-protocol ret)))))
|
||||
|
||||
(defn normalize-asset-resource-url
|
||||
|
||||
@@ -1470,7 +1470,7 @@
|
||||
(assets-handler/resolve-asset-real-path-url (state/get-current-repo) path)
|
||||
|
||||
(util/electron?)
|
||||
(path/path-join "assets://" full-path)
|
||||
(path/prepend-protocol "assets:" full-path)
|
||||
|
||||
(mobile-util/native-platform?)
|
||||
(mobile-util/convert-file-src full-path)
|
||||
|
||||
Reference in New Issue
Block a user