From d4ba355c62cff04ba12dec65c4e95b10ebb21228 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Fri, 18 Nov 2022 16:11:09 +0800 Subject: [PATCH] fix: local page history not working --- src/main/frontend/handler/file_sync.cljs | 30 +++++++++++++++--------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/main/frontend/handler/file_sync.cljs b/src/main/frontend/handler/file_sync.cljs index dc1896b48..c45da62b8 100644 --- a/src/main/frontend/handler/file_sync.cljs +++ b/src/main/frontend/handler/file_sync.cljs @@ -15,7 +15,8 @@ [cljs-time.coerce :as tc] [cljs-time.core :as t] [frontend.storage :as storage] - [logseq.graph-parser.util :as gp-util])) + [logseq.graph-parser.util :as gp-util] + [lambdaisland.glogi :as log])) (def *beta-unavailable? (volatile! false)) @@ -142,18 +143,25 @@ (#(js->clj % :keywordize-keys true)) ((juxt :dir :name)) (apply path/join base-path)) - version-file-paths (c (fs/readdir version-files-dir :path-only? true)))] + version-file-paths (->> (c (fs/readdir version-files-dir :path-only? true))) + (remove #{version-files-dir}))] (when-not (instance? ExceptionInfo version-file-paths) (when (seq version-file-paths) - (mapv - (fn [path] - (let [create-time - (-> (path/parse path) - (js->clj :keywordize-keys true) - :name - (#(tf/parse (tf/formatter "yyyy-MM-dd'T'HH_mm_ss.SSSZZ") %)))] - {:create-time create-time :path path :relative-path (string/replace-first path base-path "")})) - version-file-paths))))))) + (->> + (mapv + (fn [path] + (try + (let [create-time + (-> (path/parse path) + (js->clj :keywordize-keys true) + :name + (#(tf/parse (tf/formatter "yyyy-MM-dd'T'HH_mm_ss.SSSZZ") %)))] + {:create-time create-time :path path :relative-path (string/replace-first path base-path "")}) + (catch :default e + (log/error :page-history/parse-format-error e) + nil))) + version-file-paths) + (remove nil?)))))))) (defn fetch-page-file-versions [graph-uuid page] []