refactor(fs): rm redundent return date from fs protocol

fix(fs): asset url loading under nfs backend
This commit is contained in:
Andelf
2023-03-14 18:04:33 +08:00
parent a38e40bf86
commit abf7d55c7c
8 changed files with 107 additions and 63 deletions

View File

@@ -386,7 +386,9 @@
(p/then (editor-handler/make-asset-url href) #(reset! src %)))
(when @src
(let [ext (keyword (util/get-file-ext @src))
;; NOTE(andelf): Under nfs context, src might be a bare blob:http://..../uuid URI without ext info
(let [ext (keyword (or (util/get-file-ext @src)
(util/get-file-ext href)))
repo (state/get-current-repo)
repo-dir (config/get-repo-dir repo)
path (str repo-dir href)
@@ -395,8 +397,7 @@
(when (mobile-util/native-platform?)
;; File URL must be legal, so filename muse be URI-encoded
(let [[rel-dir basename] (util/get-dir-and-basename href)
basename (js/encodeURIComponent basename)
asset-url (str repo-dir rel-dir "/" basename)]
asset-url (fs2-path/path-join repo-dir rel-dir basename)]
(.share Share (clj->js {:url asset-url
:title "Open file with your favorite app"})))))]