Skip to content

Commit 04d4013

Browse files
Skip directories in orphan file sweep
listFiles() returned all directory entries including lost+found, causing EISDIR errors when the sweeper tried to unlink it. Filter to files only via readdir withFileTypes.
1 parent 11fac28 commit 04d4013

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/lib/storage-fs.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ export async function statPhoto(
4040

4141
export async function listFiles(): Promise<string[]> {
4242
try {
43-
return await readdir(STORAGE_PATH);
43+
const entries = await readdir(STORAGE_PATH, { withFileTypes: true });
44+
return entries.filter((e) => e.isFile()).map((e) => e.name);
4445
} catch (e: unknown) {
4546
if ((e as NodeJS.ErrnoException).code === "ENOENT") return [];
4647
throw e;

0 commit comments

Comments
 (0)