mirror of
https://github.com/logseq/logseq.git
synced 2026-05-03 10:26:35 +00:00
Make sure file paths are normalized before writing
This commit is contained in:
@@ -76,7 +76,8 @@
|
||||
(defn write-file!
|
||||
[repo dir path content opts]
|
||||
(when content
|
||||
(let [fs-record (get-fs dir)]
|
||||
(let [path (gp-util/path-normalize path)
|
||||
fs-record (get-fs dir)]
|
||||
(->
|
||||
(p/let [opts (assoc opts
|
||||
:error-handler
|
||||
@@ -111,18 +112,19 @@
|
||||
|
||||
(defn rename!
|
||||
[repo old-path new-path]
|
||||
(cond
|
||||
(let [new-path (gp-util/path-normalize new-path)]
|
||||
(cond
|
||||
; See https://github.com/isomorphic-git/lightning-fs/issues/41
|
||||
(= old-path new-path)
|
||||
(p/resolved nil)
|
||||
(= old-path new-path)
|
||||
(p/resolved nil)
|
||||
|
||||
:else
|
||||
(let [[old-path new-path]
|
||||
(map #(if (or (util/electron?) (mobile-util/native-platform?))
|
||||
%
|
||||
(str (config/get-repo-dir repo) "/" %))
|
||||
[old-path new-path])]
|
||||
(protocol/rename! (get-fs old-path) repo old-path new-path))))
|
||||
:else
|
||||
(let [[old-path new-path]
|
||||
(map #(if (or (util/electron?) (mobile-util/native-platform?))
|
||||
%
|
||||
(str (config/get-repo-dir repo) "/" %))
|
||||
[old-path new-path])]
|
||||
(protocol/rename! (get-fs old-path) repo old-path new-path)))))
|
||||
|
||||
(defn copy!
|
||||
[repo old-path new-path]
|
||||
|
||||
Reference in New Issue
Block a user