mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-07-14 17:17:19 +02:00
protect stat call
This commit is contained in:
@@ -20,6 +20,7 @@ async function walk(dir, root) {
|
|||||||
const output = { child: {} };
|
const output = { child: {} };
|
||||||
for (let file of files) {
|
for (let file of files) {
|
||||||
let filePath = path.join(dir, file);
|
let filePath = path.join(dir, file);
|
||||||
|
try {
|
||||||
const stats = await fs.stat(filePath);
|
const stats = await fs.stat(filePath);
|
||||||
if (file[0] == "$") {
|
if (file[0] == "$") {
|
||||||
file = "\\" + file;
|
file = "\\" + file;
|
||||||
@@ -30,6 +31,9 @@ async function walk(dir, root) {
|
|||||||
} else if (stats.isFile()) {
|
} else if (stats.isFile()) {
|
||||||
output.child[file] = { size: stats.size, sha: stats.ino };
|
output.child[file] = { size: stats.size, sha: stats.ino };
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user