From 3a894f954c0304e420e8a1bf2e34382f5057c532 Mon Sep 17 00:00:00 2001 From: Mochitto <98263539+Mochitto@users.noreply.github.com> Date: Wed, 29 Mar 2023 15:19:49 +0200 Subject: [PATCH] Fix: Updated legacy directory, which crashed the program (#10260) Fixes #10259 --- plugins/exporter.koplugin/clip.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/exporter.koplugin/clip.lua b/plugins/exporter.koplugin/clip.lua index 462d95834..3c242947f 100644 --- a/plugins/exporter.koplugin/clip.lua +++ b/plugins/exporter.koplugin/clip.lua @@ -334,12 +334,14 @@ end function MyClipping:parseHistory() local clippings = {} local history_dir = DataStorage:getHistoryDir() - for f in lfs.dir(history_dir) do - local legacy_history_file = ffiutil.joinPath(history_dir, f) - if lfs.attributes(legacy_history_file, "mode") == "file" then - local doc_file = DocSettings:getFileFromHistory(f) - if doc_file then - self:parseHistoryFile(clippings, legacy_history_file, doc_file) + if lfs.attributes(history_dir, "mode") == "directory" then + for f in lfs.dir(history_dir) do + local legacy_history_file = ffiutil.joinPath(history_dir, f) + if lfs.attributes(legacy_history_file, "mode") == "file" then + local doc_file = DocSettings:getFileFromHistory(f) + if doc_file then + self:parseHistoryFile(clippings, legacy_history_file, doc_file) + end end end end