1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2025-07-23 00:59:52 +02:00

fix mime bug

This commit is contained in:
lxsang
2018-09-15 21:35:07 +02:00
parent 90f9f116e6
commit b266f9deed
4 changed files with 24 additions and 3 deletions

View File

@ -113,7 +113,7 @@ vfs.write = function(path,data)
local uid = ulib.uid(SESSION.user)
--
if data ~= "" then
local header = string.match(data, "^data%:%w+%/%w+;base64,")
local header = string.match(data, "^data%:[%w%.-]+%/[%w%.-]+;base64,")
if header ~= nil then
local b64data = string.gsub(data, header,"")
local barr = std.b64decode(b64data)
@ -124,6 +124,8 @@ vfs.write = function(path,data)
f:write(bytes.__tostring(barr))
f:close()
end
else
return false, "Wrong data format"
end
else
bytes.write(bytes.new(0),osfile)