fix: regression of file editing on browser-app

This commit is contained in:
Andelf
2023-02-21 17:47:15 +08:00
committed by Gabriel Horner
parent db356ac946
commit 5a2884038b

View File

@@ -75,9 +75,16 @@
(let [*content (atom nil)
[path format] (:rum/args state)
repo-dir (config/get-repo-dir (state/get-current-repo))
[dir path] (if (string/starts-with? path repo-dir)
[dir path] (cond
(string/starts-with? path repo-dir)
[repo-dir (-> (string/replace-first path repo-dir "")
(string/replace #"^/+" ""))]
;; browser-fs
(not (string/starts-with? path "/"))
[repo-dir path]
:else
["" path])]
(when (and format (contains? (gp-config/text-formats) format))
(p/let [content (fs/read-file dir path)]