fix: missing normalized for file watcher ipc

This commit is contained in:
Junyi Du
2022-02-19 17:45:19 +08:00
parent e6c1fc2b3d
commit 89e13b58f9

View File

@@ -9,11 +9,14 @@
[frontend.handler.file :as file-handler]
[frontend.handler.page :as page-handler]
[frontend.handler.ui :as ui-handler]
[frontend.util :as util]
[lambdaisland.glogi :as log]
[electron.ipc :as ipc]
[promesa.core :as p]
[frontend.state :as state]))
;; all IPC paths must be normalized! (via util/path-normalize)
(defn- set-missing-block-ids!
[content]
(when (string? content)
@@ -39,7 +42,8 @@
(defn handle-changed!
[type {:keys [dir path content stat] :as payload}]
(when dir
(let [repo (config/get-local-repo dir)
(let [path (util/path-normalize path)
repo (config/get-local-repo dir)
{:keys [mtime]} stat
db-content (or (db/get-file repo path) "")]
(when (and (or content (= type "unlink"))