瀏覽代碼

Merge pull request #2852 from spacefreak86/mime_types

[Minor] Improve mime_types plugin
tags/1.9.2
Vsevolod Stakhov 5 年之前
父節點
當前提交
51746c8275
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 6 行新增4 行删除
  1. 6
    4
      src/plugins/lua/mime_types.lua

+ 6
- 4
src/plugins/lua/mime_types.lua 查看文件

@@ -851,6 +851,9 @@ local function check_mime_type(task)
fname:sub(1, ch_pos)))
end

-- Decode hex encoded characters
fname = string.gsub(fname, '%%(%x%x)', function (hex) return string.char(tonumber(hex,16)) end )

-- Replace potentially bad characters with '?'
fname = fname:gsub('[^%s%g]', '?')

@@ -1083,13 +1086,12 @@ local function check_mime_type(task)
end

if map then
local v
local v = map:get_key(ct)
local detected_different = false
if detected_ct and detected_ct ~= ct then
v = map:get_key(detected_ct)
local v_detected = map:get_key(detected_ct)
if v_detected > v then v = v_detected end
detected_different = true
else
v = map:get_key(ct)
end
if v then
local n = tonumber(v)

Loading…
取消
儲存