Wallabag: skip archive dir in recursive scan (#15767)
macos / macOS 15 x86-64 🔨16.4 🎯10.15 (push) Canceled after 0s
macos / macOS 15 ARM64 🔨16.4 🎯11.0 (push) Canceled after 0s

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: 896646bf8b ("Reworked the Wallabag plugin to recursively scan the download directory (#15558)")
Fixes: https://github.com/koreader/koreader/pull/15558#issuecomment-5136923551
This commit is contained in:
Tomáš Janoušek authored and GitHub committed 2026-07-31 14:51:24 +02:00
1 parent 820ad724ac
commit 9192014d8b
1 file changed
+4 -4
+4 -4
View File
@@ -1421,16 +1421,12 @@ 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
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
end
return result
end
@@ -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)