1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-12-26 01:18:21 +01: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

@ -1,6 +1,6 @@
BUILDDIR = ./build
projs = grs info blog apps
copyfiles = index.ls
copyfiles = index.ls mimes.json
main: clean copy
for f in $(projs); do make -C "$${f}" ; done

View File

@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.9.3
// Generated by CoffeeScript 1.12.7
(function() {
var APIManager, BaseObject, MarkOn,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },

19
mimes.json Normal file
View File

@ -0,0 +1,19 @@
{
"odt": { "mime": "application/vnd.oasis.opendocument.text", "binary": true },
"viz": {
"mime": "text/vnd.graphviz",
"binary": false
},
"py": {
"mime": "text/x-python",
"binary": false
},
"coffee":{
"mime": "text/vnd.coffeescript",
"binary": false
},
"apj": {
"mime": "text/antos-project",
"binary": false
}
}

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)