From 687074fa1fc166f2a405ea7819f5144936d1d1d8 Mon Sep 17 00:00:00 2001 From: poire-z Date: Mon, 17 Feb 2020 23:46:31 +0100 Subject: [PATCH] CoverBrowser: fix "Extract and cache" crash (#5874) --- plugins/coverbrowser.koplugin/bookinfomanager.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/coverbrowser.koplugin/bookinfomanager.lua b/plugins/coverbrowser.koplugin/bookinfomanager.lua index 9adf10901..ac2d8ed1c 100644 --- a/plugins/coverbrowser.koplugin/bookinfomanager.lua +++ b/plugins/coverbrowser.koplugin/bookinfomanager.lua @@ -651,6 +651,7 @@ function BookInfoManager:cleanUp() end local function findFilesInDir(path, recursive) + local stringStartsWith = require("util").stringStartsWith local dirs = {path} local files = {} while #dirs ~= 0 do @@ -662,10 +663,10 @@ local function findFilesInDir(path, recursive) local fullpath = d.."/"..f local attributes = lfs.attributes(fullpath) -- Don't traverse hidden folders if we're not showing them - if recursive and attributes.mode == "directory" and f ~= "." and f ~= ".." and (G_reader_settings:isTrue("show_hidden") or not util.stringStartsWith(f, ".")) then + if recursive and attributes.mode == "directory" and f ~= "." and f ~= ".." and (G_reader_settings:isTrue("show_hidden") or not stringStartsWith(f, ".")) then table.insert(new_dirs, fullpath) -- Always ignore macOS resource forks, too. - elseif attributes.mode == "file" and not util.stringStartsWith(f, "._") and DocumentRegistry:hasProvider(fullpath) then + elseif attributes.mode == "file" and not stringStartsWith(f, "._") and DocumentRegistry:hasProvider(fullpath) then table.insert(files, fullpath) end end