From a3d4e97545f45929107a980f8342f08496a26b9c Mon Sep 17 00:00:00 2001 From: hius07 <62179190+hius07@users.noreply.github.com> Date: Wed, 19 Mar 2025 08:00:35 +0200 Subject: [PATCH] opdsbrowser: fix group download (#13428) --- plugins/opds.koplugin/opdsbrowser.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/opds.koplugin/opdsbrowser.lua b/plugins/opds.koplugin/opdsbrowser.lua index e2f51f268..3db1ef2f4 100644 --- a/plugins/opds.koplugin/opdsbrowser.lua +++ b/plugins/opds.koplugin/opdsbrowser.lua @@ -645,7 +645,7 @@ function OPDSBrowser:showDownloads(item) table.insert(self.downloads, { file = self:getLocalDownloadPath(filename, filetype, acquisition.href), url = acquisition.href, - info = type(item.content) == "string" and util.htmlToPlainTextIfHtml(item.content), + info = type(item.content) == "string" and util.htmlToPlainTextIfHtml(item.content) or "", catalog = self.root_catalog_title, }) self._manager.updated = true @@ -1016,7 +1016,9 @@ function OPDSBrowser:showDownloadListItemDialog(item) remove_item() self._manager.file_downloaded_callback(local_path) end - self._manager:downloadFile(dl_item.file, dl_item.url, file_downloaded_callback) + NetworkMgr:runWhenConnected(function() + self._manager:downloadFile(dl_item.file, dl_item.url, file_downloaded_callback) + end) end, }, }, @@ -1048,9 +1050,11 @@ function OPDSBrowser:showDownloadListItemDialog(item) text = _("Download all books?\nExisting files will be overwritten."), ok_text = _("Download"), ok_callback = function() - local Trapper = require("ui/trapper") - Trapper:wrap(function() - self._manager:downloadDownloadList() + NetworkMgr:runWhenConnected(function() + local Trapper = require("ui/trapper") + Trapper:wrap(function() + self._manager:downloadDownloadList() + end) end) end, })