fix(ios): remove private part from file watcher events

This commit is contained in:
Tienson Qin
2022-11-07 20:44:58 +08:00
parent 222ce20946
commit 02dfb9ede5
3 changed files with 22 additions and 13 deletions

View File

@@ -212,6 +212,11 @@
(error-handler error)
(log/error :write-file-failed error)))))))))
(defn remove-private-part
"iOS sometimes return the private part."
[path]
(string/replace path "///private/" "///"))
(defn normalize-file-protocol-path [dir path]
(let [dir (some-> dir (string/replace #"/+$" ""))
dir (if (and (not-empty dir) (string/starts-with? dir "/"))
@@ -243,9 +248,8 @@
:else
(let [path' (safe-encode-url path)]
(str dir "/" path')))
path' (string/replace path' "///private/" "///")]
path'))
(str dir "/" path')))]
(remove-private-part path)))
(defn- local-container-path?
"Check whether `path' is logseq's container `localDocumentsPath' on iOS"