Skip to content

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search

fix: Dont attempt to remove uploaded tmp file if it's already removed

MohamedBassem096af7efffe1
diff --git a/packages/api/utils/upload.ts b/packages/api/utils/upload.ts
index 970323fd..6f18790b 100644
--- a/packages/api/utils/upload.ts
+++ b/packages/api/utils/upload.ts
@@ -119,7 +119,13 @@ export async function uploadAsset(
fileName,
};
} finally {
- if (tempFilePath) {
+ if (
+ tempFilePath &&
+ (await fs.promises
+ .access(tempFilePath)
+ .then(() => true)
+ .catch(() => false))
+ ) {
await fs.promises.unlink(tempFilePath).catch(() => ({}));
}
}