From 7b2eba73bafd966d41351dc0bd4c34ba7332c81f Mon Sep 17 00:00:00 2001 From: Alex Vanderpot Date: Sat, 6 Mar 2021 10:29:36 -0800 Subject: [PATCH] Do not include author in OPDS download filename if nil or empty (#7384) --- plugins/opds.koplugin/opdsbrowser.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/opds.koplugin/opdsbrowser.lua b/plugins/opds.koplugin/opdsbrowser.lua index 1cefa1934..df51cdc38 100644 --- a/plugins/opds.koplugin/opdsbrowser.lua +++ b/plugins/opds.koplugin/opdsbrowser.lua @@ -552,7 +552,13 @@ end function OPDSBrowser:downloadFile(item, filetype, remote_url) -- Download to user selected folder or last opened folder. local download_dir = self.getCurrentDownloadDir() - local filename = util.getSafeFilename(item.author .. " - " .. item.title .. "." .. filetype, download_dir) + + local filename = item.title .. "." .. filetype + if item.author then + filename = item.author .. " - " .. filename + end + + filename = util.getSafeFilename(filename, download_dir) local local_path = download_dir .. "/" .. filename local_path = util.fixUtf8(local_path, "_")