mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-06-05 20:45:45 +08:00
fix(file-tree): inspect entries with lstat
Use lstat for file-tree metadata so symlink entries are identified without following targets.
This commit is contained in:
@@ -1564,17 +1564,28 @@ async function getFileTree(dirPath, maxDepth = 3, currentDepth = 0, showHidden =
|
|||||||
try {
|
try {
|
||||||
await acquire();
|
await acquire();
|
||||||
try {
|
try {
|
||||||
const stats = await fsPromises.stat(itemPath);
|
const stats = await fsPromises.lstat(itemPath);
|
||||||
item.size = stats.size;
|
item.size = stats.size;
|
||||||
item.modified = stats.mtime.toISOString();
|
item.modified = stats.mtime.toISOString();
|
||||||
|
|
||||||
// Convert permissions to rwx format
|
// Mark symlinks so UI can distinguish them
|
||||||
const mode = stats.mode;
|
if (stats.isSymbolicLink()) {
|
||||||
const ownerPerm = (mode >> 6) & 7;
|
item.isSymlink = true;
|
||||||
const groupPerm = (mode >> 3) & 7;
|
}
|
||||||
const otherPerm = mode & 7;
|
|
||||||
item.permissions = ((mode >> 6) & 7).toString() + ((mode >> 3) & 7).toString() + (mode & 7).toString();
|
// Convert permissions to rwx format
|
||||||
item.permissionsRwx = permToRwx(ownerPerm) + permToRwx(groupPerm) + permToRwx(otherPerm);
|
const mode = stats.mode;
|
||||||
|
const ownerPerm = (mode >> 6) & 7;
|
||||||
|
const groupPerm = (mode >> 3) & 7;
|
||||||
|
const otherPerm = mode & 7;
|
||||||
|
item.permissions =
|
||||||
|
((mode >> 6) & 7).toString() +
|
||||||
|
((mode >> 3) & 7).toString() +
|
||||||
|
(mode & 7).toString();
|
||||||
|
item.permissionsRwx =
|
||||||
|
permToRwx(ownerPerm) +
|
||||||
|
permToRwx(groupPerm) +
|
||||||
|
permToRwx(otherPerm);
|
||||||
} finally {
|
} finally {
|
||||||
release();
|
release();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user