[plugin] Change OPDS filetype algorithm to extension first, mimetype second (#8115)

Fixes <https://github.com/koreader/koreader/issues/7995>.
reviewable/pr8126/r1
Frans de Jonge 3 years ago committed by GitHub
parent b56897f61e
commit a558376471
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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()

Loading…
Cancel
Save