mirror of
https://github.com/lovasoa/whitebophir
synced 2024-11-14 16:27:13 +00:00
Fix the board download feature
This commit is contained in:
parent
43370fac3d
commit
dbc498acea
2 changed files with 9 additions and 5 deletions
|
@ -3,7 +3,7 @@
|
|||
"collaborative",
|
||||
"whiteboard"
|
||||
],
|
||||
"version": "1.0.0-18",
|
||||
"version": "1.0.0-19",
|
||||
"dependencies": {
|
||||
"node-static": "0.7.x",
|
||||
"socket.io": "0.9.x"
|
||||
|
|
|
@ -61,14 +61,18 @@ function handler (request, response) {
|
|||
}
|
||||
|
||||
} else if (parts[0] === "download") {
|
||||
var history_file = "../server-data/board-" + encodeURIComponent(parts[1]),
|
||||
headers = {"Content-Type": "text/x-wbo"};
|
||||
var boardName = encodeURIComponent(parts[1]),
|
||||
history_file = "../server-data/board-" + boardName + ".json",
|
||||
headers = {
|
||||
"Content-Type": "application/json",
|
||||
"Content-Disposition": 'attachment; filename="'+boardName+'.wbo"'
|
||||
};
|
||||
var promise = fileserver.serveFile(history_file, 200, headers, request, response);
|
||||
promise.on("error", function(){
|
||||
promise.on("error", function(err){
|
||||
console.error("Error while downloading history", err);
|
||||
response.statusCode = 404;
|
||||
response.end("ERROR: Unable to serve history file\n");
|
||||
});
|
||||
|
||||
} else {
|
||||
fileserver.serve(request, response, function (err, res){
|
||||
if (err) serveError(request, response, err);
|
||||
|
|
Loading…
Reference in a new issue