mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(rest) onFS
This commit is contained in:
parent
d245733864
commit
d92892b84c
1 changed files with 11 additions and 10 deletions
|
|
@ -148,29 +148,30 @@
|
|||
case 'GET':
|
||||
onFSGet(query, path, function(error, data) {
|
||||
var str,
|
||||
isStr = Util.isString(data);
|
||||
isStr = Util.isString(data),
|
||||
params = {
|
||||
gzip: true,
|
||||
name: path,
|
||||
request: p.request,
|
||||
response: p.response,
|
||||
};
|
||||
|
||||
if (error) {
|
||||
if (error.code === 'ENOTDIR')
|
||||
main.sendFile({
|
||||
gzip: true,
|
||||
name: path,
|
||||
request: p.request,
|
||||
response: p.response,
|
||||
});
|
||||
main.sendFile(params);
|
||||
else
|
||||
sendError(params, error);
|
||||
} else {
|
||||
data.path = format.addSlashToEnd(p.name);
|
||||
p.name += '.json';
|
||||
p.query = query;
|
||||
params.name += '.json';
|
||||
params.query = query;
|
||||
|
||||
if (isStr)
|
||||
str = data;
|
||||
else
|
||||
str = Util.stringifyJSON(data);
|
||||
|
||||
sendResponse(p, str, NOT_LOG);
|
||||
sendResponse(params, str, NOT_LOG);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue