mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(rest) onFSGet
This commit is contained in:
parent
9fca915d72
commit
e3a5ccc012
1 changed files with 5 additions and 8 deletions
|
|
@ -132,13 +132,16 @@
|
|||
switch (p.request.method) {
|
||||
case 'GET':
|
||||
onFSGet(query, p.name, function(error, data, isFile) {
|
||||
var str;
|
||||
|
||||
if (error)
|
||||
sendError(params, error);
|
||||
else if (isFile)
|
||||
main.sendFile(p);
|
||||
else {
|
||||
p.name += '.json';
|
||||
sendResponse(p, data);
|
||||
str = Util.stringifyJSON(data);
|
||||
sendResponse(p, str);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -347,13 +350,7 @@
|
|||
if (!isDir)
|
||||
func(null, null, !isDir);
|
||||
else
|
||||
getDirContent(name, function(error, data) {
|
||||
if (!error) {
|
||||
data = Util.stringifyJSON(data);
|
||||
}
|
||||
|
||||
func(error, data);
|
||||
});
|
||||
getDirContent(name, func);
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue