From 97fac90779442d270616db41159f7918157cd2f9 Mon Sep 17 00:00:00 2001 From: Wim de With Date: Sun, 29 Jun 2025 09:56:16 +0200 Subject: [PATCH 1/2] Pass ui parameter to all collate item_funcs (#13981) --- frontend/ui/widget/filechooser.lua | 2 +- frontend/ui/widget/pathchooser.lua | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/frontend/ui/widget/filechooser.lua b/frontend/ui/widget/filechooser.lua index 9add79163..41a2591a5 100644 --- a/frontend/ui/widget/filechooser.lua +++ b/frontend/ui/widget/filechooser.lua @@ -183,7 +183,7 @@ function FileChooser:getListItem(dirpath, f, fullpath, attributes, collate) item.text = item.text.."/" item.bidi_wrap_func = BD.directory if collate.can_collate_mixed and collate.item_func ~= nil then -- used by user plugin/patch, don't remove - collate.item_func(item) + collate.item_func(item, self.ui) end if dirpath then -- file browser or PathChooser item.mandatory = self:getMenuItemMandatory(item) diff --git a/frontend/ui/widget/pathchooser.lua b/frontend/ui/widget/pathchooser.lua index eaec89a34..caae59adc 100644 --- a/frontend/ui/widget/pathchooser.lua +++ b/frontend/ui/widget/pathchooser.lua @@ -22,10 +22,7 @@ local PathChooser = FileChooser:extend{ } function PathChooser:init() - local collate = G_reader_settings:readSetting("collate") - if self.show_files and (collate == "title" or collate == "authors" or collate == "series" or collate == "keywords") then - self.ui = require("apps/reader/readerui").instance or require("apps/filemanager/filemanager").instance - end + self.ui = require("apps/reader/readerui").instance or require("apps/filemanager/filemanager").instance if self.title == true then -- default title depending on options if self.select_directory and not self.select_file then From 7d89cb2ed4976a8401554786db6f3d96b675527a Mon Sep 17 00:00:00 2001 From: hrm Date: Mon, 30 Jun 2025 10:07:00 +0200 Subject: [PATCH 2/2] [plugin] Fix wallabag directories' trailing slashes (#14001) --- plugins/wallabag.koplugin/main.lua | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/plugins/wallabag.koplugin/main.lua b/plugins/wallabag.koplugin/main.lua index 8f7c4947d..5a2758276 100644 --- a/plugins/wallabag.koplugin/main.lua +++ b/plugins/wallabag.koplugin/main.lua @@ -114,7 +114,7 @@ function Wallabag:init() self.archive_directory = self.wb_settings.data.wallabag.archive_directory if not self.archive_directory or self.archive_directory == "" then if self.directory and self.directory ~= "" then - self.archive_directory = self.directory.."archive/" + self.archive_directory = FFIUtil.joinPath(self.directory, "archive") end end @@ -566,11 +566,6 @@ function Wallabag:getBearerToken() return false end - -- Add trailing slash if it is missing - if string.sub(self.directory, -1) ~= "/" then - self.directory = self.directory .. "/" - end - -- Check if token is valid for at least 5 minutes. If so, no need to renew local now = os.time() if self.token_expiry - now > 300 then @@ -762,7 +757,7 @@ function Wallabag:downloadArticle(article) end end - local local_path = self.directory .. article_id_prefix .. article.id .. article_id_postfix .. title .. file_ext + local local_path = FFIUtil.joinPath(self.directory, article_id_prefix..article.id..article_id_postfix..title..file_ext) logger.dbg("Wallabag:downloadArticle: downloading", article.id, "to", local_path) local attr = lfs.attributes(local_path) @@ -1084,7 +1079,7 @@ function Wallabag:processRemoteDeletes(remote_ids) local count = 0 for entry in lfs.dir(self.directory) do - local entry_path = self.directory .. entry + local entry_path = FFIUtil.joinPath(self.directory, entry) if entry ~= "." and entry ~= ".." and lfs.attributes(entry_path, "mode") == "file" then local local_id = self:getArticleID(entry_path) @@ -1133,7 +1128,7 @@ function Wallabag:uploadStatuses(quiet) local skip = false if entry ~= "." and entry ~= ".." then - local entry_path = self.directory .. entry + local entry_path = FFIUtil.joinPath(self.directory, entry) if DocSettings:hasSidecarFile(entry_path) then logger.dbg("Wallabag:uploadStatuses:", entry_path, "has sidecar file") @@ -1329,7 +1324,7 @@ function Wallabag:archiveLocalArticle(path) if lfs.attributes(path, "mode") == "file" then local _, file = util.splitFilePathName(path) - local new_path = self.archive_directory..file + local new_path = FFIUtil.joinPath(self.archive_directory, file) if FileManager:moveFile(path, new_path) then result = 1 end @@ -1530,7 +1525,7 @@ function Wallabag:setDownloadDirectory(touchmenu_instance) onConfirm = function(path) self.directory = path self:saveSettings() - logger.dbg("Wallabag:setDownloadDirectory: set download directory to", path) + logger.dbg("Wallabag:setDownloadDirectory: set download directory to", self.directory) if touchmenu_instance then touchmenu_instance:updateItems() end @@ -1544,7 +1539,7 @@ function Wallabag:setArchiveDirectory(touchmenu_instance) onConfirm = function(path) self.archive_directory = path self:saveSettings() - logger.dbg("Wallabag:setArchiveDirectory: set archive directory to", path) + logger.dbg("Wallabag:setArchiveDirectory: set archive directory to", self.archive_directory) if touchmenu_instance then touchmenu_instance:updateItems() end @@ -1612,7 +1607,7 @@ function Wallabag:saveSettings() remove_read_from_history = self.remove_read_from_history, remove_abandoned_from_history = self.remove_abandoned_from_history, download_original_document = self.download_original_document, - offline_queue = self.offline_queue, + offline_queue = self.offline_queue, use_local_archive = self.use_local_archive, archive_directory = self.archive_directory, file_block_timeout = self.file_block_timeout,