Skip to content

Commit cd4b4f9

Browse files
committed
fix: handle symlinks in IPFS folder upload
1 parent 9cb73c1 commit cd4b4f9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

nest/src/services/ipfs/ipfs.service.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,19 @@ export class IpfsService {
117117
const fullPath = path.join(dir, entry.name);
118118
if (entry.isDirectory()) {
119119
files.push(...(await this.getFilesRecursively(fullPath)));
120+
} else if (entry.isSymbolicLink()) {
121+
// Check if symlink points to a directory or file
122+
try {
123+
const stat = await fs.stat(fullPath);
124+
if (stat.isDirectory()) {
125+
files.push(...(await this.getFilesRecursively(fullPath)));
126+
} else {
127+
files.push(fullPath);
128+
}
129+
} catch {
130+
// Skip broken symlinks
131+
this.logger.warn(`Skipping broken symlink: ${fullPath}`);
132+
}
120133
} else {
121134
files.push(fullPath);
122135
}

0 commit comments

Comments
 (0)