From a55837647198a6a1d64aa6b064b0b1fe5e2642a4 Mon Sep 17 00:00:00 2001 From: Frans de Jonge Date: Mon, 23 Aug 2021 12:44:07 +0200 Subject: [PATCH] [plugin] Change OPDS filetype algorithm to extension first, mimetype second (#8115) Fixes . --- plugins/opds.koplugin/opdsbrowser.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/opds.koplugin/opdsbrowser.lua b/plugins/opds.koplugin/opdsbrowser.lua index 0398b7626..d5f4cb45e 100644 --- a/plugins/opds.koplugin/opdsbrowser.lua +++ b/plugins/opds.koplugin/opdsbrowser.lua @@ -630,13 +630,16 @@ function OPDSBrowser:showDownloads(item) local index = (i-1)*downloadsperline + j local acquisition = acquisitions[index] if acquisition then - local filetype - if DocumentRegistry:hasProvider(nil, acquisition.type) then + local filetype = util.getFileNameSuffix(acquisition.href) + if not DocumentRegistry:hasProvider("dummy."..filetype) then + filetype = nil + end + if not filetype and DocumentRegistry:hasProvider(nil, acquisition.type) then filetype = DocumentRegistry:mimeToExt(acquisition.type) - elseif DocumentRegistry:hasProvider(acquisition.href) then - filetype = string.lower(util.getFileNameSuffix(acquisition.href)) end + if filetype then + filetype = string.lower(filetype) -- append DOWNWARDS BLACK ARROW ⬇ U+2B07 to format button.text = string.upper(filetype) .. "\xE2\xAC\x87" button.callback = function()