2
0
mirror of https://github.com/koreader/koreader synced 2024-11-18 03:25:46 +00:00

Fix: Updated legacy directory, which crashed the program (#10260)

Fixes #10259
This commit is contained in:
Mochitto 2023-03-29 15:19:49 +02:00 committed by GitHub
parent 91fc8a0061
commit 3a894f954c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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