mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-07 03:40:16 +00:00
Use lstat rather than stat to avoid error with symlinks in sync
Change-type: patch Closes: #1301 Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
313ee2048a
commit
a7399fd78b
@ -99,10 +99,6 @@ async function tarDirectory(
|
|||||||
const entries = await fs.readdir(path);
|
const entries = await fs.readdir(path);
|
||||||
for (const entry of entries) {
|
for (const entry of entries) {
|
||||||
const newPath = Path.resolve(path, entry);
|
const newPath = Path.resolve(path, entry);
|
||||||
const stat = await fs.stat(newPath);
|
|
||||||
if (stat.isDirectory()) {
|
|
||||||
await add(newPath);
|
|
||||||
} else {
|
|
||||||
// Here we filter the things we don't want
|
// Here we filter the things we don't want
|
||||||
if (
|
if (
|
||||||
newPath.includes('node_modules/') ||
|
newPath.includes('node_modules/') ||
|
||||||
@ -112,7 +108,12 @@ async function tarDirectory(
|
|||||||
) {
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// We use lstat here, otherwise an error will be
|
||||||
|
// thrown on a symbolic link
|
||||||
|
const stat = await fs.lstat(newPath);
|
||||||
|
if (stat.isDirectory()) {
|
||||||
|
await add(newPath);
|
||||||
|
} else {
|
||||||
if (newPath.endsWith('Dockerfile')) {
|
if (newPath.endsWith('Dockerfile')) {
|
||||||
pack.entry(
|
pack.entry(
|
||||||
{ name: 'Dockerfile', mode: stat.mode, size: stat.size },
|
{ name: 'Dockerfile', mode: stat.mode, size: stat.size },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user