mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-21 02:29:23 +00:00
refactor(rest) onFS
This commit is contained in:
parent
e707ed9853
commit
c4b7b5e3ee
1 changed files with 13 additions and 13 deletions
|
|
@ -106,32 +106,32 @@
|
|||
case 'GET':
|
||||
if (Util.strCmp(lQuery, 'size'))
|
||||
dir.getSize(p.name, function(pErr, pSize) {
|
||||
if (!pErr){
|
||||
if (pErr)
|
||||
main.sendError(p, pErr);
|
||||
else {
|
||||
lSize = CloudFunc.getShortSize(pSize);
|
||||
Util.log(lSize);
|
||||
main.sendResponse(p, lSize);
|
||||
}
|
||||
else
|
||||
main.sendError(p, pErr);
|
||||
|
||||
});
|
||||
else
|
||||
fs.stat(p.name, function(pError, pStat) {
|
||||
if (!pError)
|
||||
if (pStat.isDirectory())
|
||||
if (pError)
|
||||
main.sendError(p, pError);
|
||||
else
|
||||
if (!pStat.isDirectory())
|
||||
main.sendFile(p);
|
||||
else
|
||||
main.commander.getDirContent(p.name, function(pError, pData) {
|
||||
if (!pError){
|
||||
if (pError)
|
||||
main.sendError(p, pError);
|
||||
else {
|
||||
p.name += '.json';
|
||||
p.data = Util.stringifyJSON(pData);
|
||||
main.sendResponse(p);
|
||||
}
|
||||
else
|
||||
main.sendError(p, pError);
|
||||
});
|
||||
else
|
||||
main.sendFile(p);
|
||||
else
|
||||
main.sendError(p, pError);
|
||||
|
||||
});
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue