mirror of
https://github.com/lxsang/antd-web-apps
synced 2024-12-25 17:08:22 +01:00
fix
This commit is contained in:
parent
7680b00b66
commit
4cc896c1e1
@ -82,35 +82,7 @@ function VFSController:get(...)
|
||||
local vfsfile = utils.decodeURI(uri)
|
||||
local r, m = require("vfs").checkperm(vfsfile, "read")
|
||||
if r then
|
||||
local mime = std.mimeOf(m)
|
||||
local finfo = ulib.file_stat(m)
|
||||
local len = tostring(math.floor(finfo.size))
|
||||
local len1 = tostring(math.floor(finfo.size - 1))
|
||||
if mime == "audio/mpeg" then
|
||||
std.status(200, "OK")
|
||||
std.custom_header("Pragma", "public")
|
||||
std.custom_header("Expires", "0")
|
||||
std.custom_header("Content-Type", mime)
|
||||
std.custom_header("Content-Length", len)
|
||||
std.custom_header("Content-Disposition", "inline; filename=" .. std.basename(m))
|
||||
std.custom_header("Content-Range:", "bytes 0-" .. len1 .. "/" .. len)
|
||||
std.custom_header("Accept-Ranges", "bytes")
|
||||
std.custom_header("X-Pad", "avoid browser bug")
|
||||
std.custom_header("Content-Transfer-Encoding", "binary")
|
||||
std.custom_header("Cache-Control", "no-cache, no-store")
|
||||
std.custom_header("Connection", "Keep-Alive")
|
||||
std.custom_header("Etag", "a404b-c3f-47c3a14937c80")
|
||||
else
|
||||
std.status(200, "OK")
|
||||
std.custom_header("Content-Type", mime)
|
||||
std.custom_header("Content-Length", len)
|
||||
end
|
||||
std.header_flush()
|
||||
if std.is_bin(m) then
|
||||
std.fb(m)
|
||||
else
|
||||
std.f(m)
|
||||
end
|
||||
std.sendFile(m)
|
||||
else
|
||||
fail(m)
|
||||
end
|
||||
|
@ -31,12 +31,7 @@ shared.get = function(sharedid)
|
||||
else
|
||||
|
||||
local p = shared.ospath(sharedid)
|
||||
std.header(std.mimeOf(p))
|
||||
if std.is_bin(p) then
|
||||
std.fb(p)
|
||||
else
|
||||
std.f(p)
|
||||
end
|
||||
std.sendFile(p)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -97,12 +97,7 @@ function AssetController:get(...)
|
||||
if self.registry.fileaccess and ulib.exists(path) then
|
||||
local mime = std.mimeOf(path)
|
||||
if POLICY.mimes[mime] then
|
||||
std.header(mime)
|
||||
if std.isBinary(path) then
|
||||
std.fb(path)
|
||||
else
|
||||
std.f(path)
|
||||
end
|
||||
std.sendFile(path)
|
||||
else
|
||||
self:error("Access forbidden: "..path)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user