提交 c6446c31 authored 作者: zhanrongzhen's avatar zhanrongzhen

修复require detect的bug

上级 18a940bb
...@@ -62,4 +62,4 @@ local function detect(filepath) ...@@ -62,4 +62,4 @@ local function detect(filepath)
return "application/octet-stream" return "application/octet-stream"
end end
return detec return detect
...@@ -92,14 +92,14 @@ http { ...@@ -92,14 +92,14 @@ http {
local ext = string.match(filename, "%.([^%.]+)$") local ext = string.match(filename, "%.([^%.]+)$")
local mime_type local mime_type
local detect_module = require "detect_mime_by_magic" local detect = require "detect_mime_by_magic"
if ext then if ext then
-- mime_type = get_mime_type(ext) -- mime_type = get_mime_type(ext)
-- 有扩展名,用download下载 -- 有扩展名,用download下载
return ngx.exec("/download/" .. filename) return ngx.exec("/download/" .. filename)
else else
-- 无扩展名:用 Lua 魔数检测 -- 无扩展名:用 Lua 魔数检测
mime_type = detect_module.detect(filepath) mime_type = detect(filepath)
end end
-- 3. 设置响应头 -- 3. 设置响应头
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论