mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(route) route
This commit is contained in:
parent
0026971da2
commit
4334b34637
1 changed files with 13 additions and 14 deletions
|
|
@ -163,20 +163,7 @@
|
|||
if (dir)
|
||||
dir.path = format.addSlashToEnd(name);
|
||||
|
||||
if (error)
|
||||
if (error.code !== 'ENOTDIR')
|
||||
ponse.sendError(error, p);
|
||||
else
|
||||
fs.realpath(path, function(error, pathReal) {
|
||||
if (!error)
|
||||
p.name = pathReal;
|
||||
else
|
||||
p.name = path;
|
||||
|
||||
p.gzip = false;
|
||||
ponse.sendFile(p);
|
||||
});
|
||||
else
|
||||
if (!error)
|
||||
buildIndex(dir, function(error, data) {
|
||||
p.name = PATH_INDEX;
|
||||
|
||||
|
|
@ -185,6 +172,18 @@
|
|||
else
|
||||
ponse.send(data, p);
|
||||
});
|
||||
else if (error.code !== 'ENOTDIR')
|
||||
ponse.sendError(error, p);
|
||||
else
|
||||
fs.realpath(path, function(error, pathReal) {
|
||||
if (!error)
|
||||
p.name = pathReal;
|
||||
else
|
||||
p.name = path;
|
||||
|
||||
p.gzip = false;
|
||||
ponse.sendFile(p);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue