feature(cloudcmd) fs: add realpath

This commit is contained in:
coderaiser 2014-09-11 15:04:19 +00:00
parent c8a4817e1d
commit 188989a412
2 changed files with 18 additions and 8 deletions

View file

@ -201,13 +201,18 @@
dir.path = format.addSlashToEnd(name);
if (error)
if (error.code === 'ENOTDIR') {
p.name = path;
p.gzip = false;
ponse.sendFile(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);
});
else
buildIndex(dir, function(error, data) {
var NOT_LOG = true;

View file

@ -161,8 +161,13 @@
};
if (isFile) {
params.gzip = false;
ponse.sendFile(params);
fs.realpath(path, function(error, path) {
if (!error)
params.name = path;
params.gzip = false;
ponse.sendFile(params);
});
} else {
if (!error) {
data.path = format.addSlashToEnd(p.name);