diff options
-rw-r--r-- | src/plugins/lua/mime_types.lua | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/plugins/lua/mime_types.lua b/src/plugins/lua/mime_types.lua index eac91adc6..27dbfc89c 100644 --- a/src/plugins/lua/mime_types.lua +++ b/src/plugins/lua/mime_types.lua @@ -781,7 +781,7 @@ local full_extensions_map = { {"xltm", "application/vnd.ms-excel.template.macroEnabled.12"}, {"xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template"}, {"xlw", "application/vnd.ms-excel"}, - {"xml", "text/xml"}, + {"xml", {"application/xml", "text/xml"}}, {"xmp", "application/octet-stream" }, {"xmta", "application/xml"}, {"xof", "x-world/x-vrml"}, @@ -974,34 +974,34 @@ if opts then settings[k] = v end - -- Transform extension_map - for k,v in pairs(settings.extension_map) do - if type(v) == 'table' then + local function change_extension_map_entry(ext, ct, mult) + if type(ct) == 'table' then local tbl = {} - for _,elt in ipairs(v) do + for _,elt in ipairs(ct) do table.insert(tbl, { ct = elt, - mult = 1.0, + mult = mult, }) end - settings.extension_map[k] = tbl + settings.extension_map[ext] = tbl else - settings.extension_map[k] = { [1] = { - ct = v, - mult = 1.0 + settings.extension_map[ext] = { [1] = { + ct = ct, + mult = mult } } end end + -- Transform extension_map + for ext,ct in pairs(settings.extension_map) do + change_extension_map_entry(ext, ct, 1.0) + end + -- Add all extensions for _,pair in ipairs(full_extensions_map) do local ext, ct = pair[1], pair[2] - if not settings.extension_map[ext] then - settings.extension_map[ext] = { [1] = { - ct = ct, - mult = settings.other_extensions_mult - } } + change_extension_map_entry(ext, ct, settings.other_extensions_mult) end end |