From 9192014d8bd82a91dc1012473be0f238dedfdb54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Janou=C5=A1ek?= Date: Fri, 31 Jul 2026 13:51:24 +0100 Subject: [PATCH] Wallabag: skip archive dir in recursive scan (#15767) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Including the archive dir in the result of Wallabag:getLocalArticles causes all archived articles' statuses to be synced with Wallabag every time. That leads to an increase in sync times from seconds to minutes (or even more if one's archive is larger than hundreds…). The fix is simple: skip the archive dir when scanning. (As a side effect, this allows one to organise their archive dir using subdirs, which is similar to the motivation of the PR that broke this…) Fixes: 896646bf8bb0 ("Reworked the Wallabag plugin to recursively scan the download directory (#15558)") Fixes: https://github.com/koreader/koreader/pull/15558#issuecomment-5136923551 --- plugins/wallabag.koplugin/main.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/wallabag.koplugin/main.lua b/plugins/wallabag.koplugin/main.lua index ba6e4ac32..077afbf95 100644 --- a/plugins/wallabag.koplugin/main.lua +++ b/plugins/wallabag.koplugin/main.lua @@ -1421,15 +1421,11 @@ function Wallabag:archiveLocalArticle(path) if lfs.attributes(path, "mode") == "file" then local _, file = util.splitFilePathName(path) local new_path = ffiUtil.joinPath(self.archive_directory, file) - if path == new_path then -- Already archived + if FileManager:moveFile(path, new_path) then result = true - else - if FileManager:moveFile(path, new_path) then - result = true - end - DocSettings.updateLocation(path, new_path, false) -- move sdr - --- @todo Why is sdr copied instead of moved? end + DocSettings.updateLocation(path, new_path, false) -- move sdr + --- @todo Why is sdr copied instead of moved? end return result @@ -1489,6 +1485,10 @@ function Wallabag:getLocalArticles(dir, map) map = {} end + if dir == self.archive_directory then + return map + end + for entry in lfs.dir(dir) do if entry ~= "." and entry ~= ".." then local entry_path = ffiUtil.joinPath(dir, entry)