do not leave download hanging when file is empty

pull/314/merge
nightwing 2016-06-17 09:17:05 +00:00
rodzic 55b84657db
commit 63e341ce00
1 zmienionych plików z 11 dodań i 0 usunięć

Wyświetl plik

@ -73,6 +73,17 @@ define(function(require, exports, module) {
meta.stream.pipe(res);
});
meta.stream.once("close", function() {
if (res.headerSent)
return;
res.writeHead(200, {
"Content-Type": "octet/stream",
"Content-Disposition": filenameHeader
});
res.end();
});
meta.stream.on("error", function(err){
res.writeHead(500);
res.end(err.message);