mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(cloudcmd) fs: add realpath
This commit is contained in:
parent
c8a4817e1d
commit
188989a412
2 changed files with 18 additions and 8 deletions
17
cloudcmd.js
17
cloudcmd.js
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue