Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

fix: "Error copying file" when no src file

Maxim Medvedev7cae35ce8d05
diff --git a/packages/filesystem/moveFile.ts b/packages/filesystem/moveFile.ts
index 66cb326b..d5388f35 100644
--- a/packages/filesystem/moveFile.ts
+++ b/packages/filesystem/moveFile.ts
@@ -30,8 +30,10 @@ export async function moveFile(from: string, to: string) {
const directory = (file: string) =>
path.join(process.cwd(), "../..", storagePath, file);
- fs.rename(directory(from), directory(to), (err) => {
- if (err) console.log("Error copying file:", err);
- });
+ if (fs.existsSync(directory(from))) {
+ fs.rename(directory(from), directory(to), (err) => {
+ if (err) console.log("Error copying file:", err);
+ });
+ }
}
}