mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-24 03:05:41 +00:00
fix(main) sendFile callback: add error condition
This commit is contained in:
parent
c4b7b5e3ee
commit
11c1cbda16
1 changed files with 5 additions and 5 deletions
|
|
@ -235,8 +235,6 @@
|
|||
if (error)
|
||||
sendError(pParams, error);
|
||||
else {
|
||||
p.response.statusCode = OK;
|
||||
|
||||
header = generateHeaders({
|
||||
name : p.name,
|
||||
cache : p.cache,
|
||||
|
|
@ -244,14 +242,15 @@
|
|||
query : getQuery(p.request)
|
||||
});
|
||||
|
||||
setHeader(header, p.response);
|
||||
p.response.writeHead(OK, header);
|
||||
|
||||
pipe.create({
|
||||
from : p.name,
|
||||
write : p.response,
|
||||
zip : lGzip && !p.gziped,
|
||||
callback: function(error) {
|
||||
sendError(pParams, error);
|
||||
if (error)
|
||||
sendError(pParams, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -283,6 +282,8 @@
|
|||
query : lQuery
|
||||
});
|
||||
|
||||
setHeader(lHead, p.response);
|
||||
|
||||
if (!pNotLog)
|
||||
Util.log(pData || p.data);
|
||||
|
||||
|
|
@ -296,7 +297,6 @@
|
|||
p.data = pParams.data;
|
||||
}
|
||||
|
||||
setHeader(lHead, p.response);
|
||||
p.response.statusCode = p.status || OK;
|
||||
p.response.end(p.data);
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue