mirror of
https://github.com/linuxserver/core.git
synced 2026-02-20 05:07:19 +08:00
Revert "fix symlink loop detection"
This reverts commit 7126015b1b5b6a47205ab80d3fa89136c206c3b5.
This commit is contained in:
parent
314947fbf7
commit
40c010cffa
35
node_modules/vfs-local/localfs.js
generated
vendored
35
node_modules/vfs-local/localfs.js
generated
vendored
@ -350,7 +350,7 @@ module.exports = function setup(fsOptions) {
|
||||
|
||||
// This helper function doesn't follow node conventions in the callback,
|
||||
// there is no err, only entry.
|
||||
function createStatEntry(file, fullpath, callback, _loop) {
|
||||
function createStatEntry(file, fullpath, callback) {
|
||||
fs.lstat(fullpath, function (err, stat) {
|
||||
var entry = {
|
||||
name: file
|
||||
@ -378,29 +378,26 @@ module.exports = function setup(fsOptions) {
|
||||
return callback(entry);
|
||||
}
|
||||
fs.readlink(fullpath, function (err, link) {
|
||||
if (entry.name == link) {
|
||||
entry.linkStatErr = "ELOOP: recursive symlink";
|
||||
return callback(entry);
|
||||
}
|
||||
|
||||
if (err) {
|
||||
entry.linkErr = err.stack;
|
||||
return callback(entry);
|
||||
}
|
||||
var fullLinkPath = pathResolve(dirname(fullpath), link);
|
||||
if (!_loop) {
|
||||
_loop = {fullLinkPath: fullpath, max: 100};
|
||||
}
|
||||
if (fullLinkPath.toLowerCase() == _loop.fullLinkPath.toLowerCase() || _loop.max --< 0) {
|
||||
entry.linkErr = "ELOOP: recursive symlink";
|
||||
return callback(entry);
|
||||
}
|
||||
entry.link = link;
|
||||
resolvePath(fullLinkPath, {alreadyRooted: true}, function (err, newpath) {
|
||||
if (err) {
|
||||
entry.linkErr = err;
|
||||
return callback(entry);
|
||||
}
|
||||
createStatEntry(basename(newpath), newpath, function (linkStat) {
|
||||
entry.linkStat = linkStat;
|
||||
linkStat.fullPath = newpath.substr(base.length) || "/";
|
||||
return callback(entry);
|
||||
}, _loop);
|
||||
resolvePath(pathResolve(dirname(fullpath), link), {alreadyRooted: true}, function (err, newpath) {
|
||||
if (err) {
|
||||
entry.linkStatErr = err;
|
||||
return callback(entry);
|
||||
}
|
||||
createStatEntry(basename(newpath), newpath, function (linkStat) {
|
||||
entry.linkStat = linkStat;
|
||||
linkStat.fullPath = newpath.substr(base.length) || "/";
|
||||
return callback(entry);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -561,8 +561,8 @@ define(function(require, exports, module) {
|
||||
node.size = stat.size;
|
||||
if (stat.mtime != undefined)
|
||||
node.mtime = stat.mtime;
|
||||
if (original_stat || stat.linkErr)
|
||||
node.link = stat.fullPath || stat.linkErr;
|
||||
if (original_stat)
|
||||
node.link = stat.fullPath;
|
||||
node.isFolder = isFolder;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user