Skip to content
This repository was archived by the owner on Feb 27, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion apps/server/src/providers/filesystem-storage.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export class FilesystemStorageProvider implements StorageProvider {

try {
await pipeline(inputStream, encryptStream, writeStream);
await fs.rename(tempPath, filePath);
await this.moveFile(tempPath, filePath);
} catch (error) {
await this.cleanupTempFile(tempPath);
throw error;
Expand Down Expand Up @@ -707,4 +707,18 @@ export class FilesystemStorageProvider implements StorageProvider {
console.error("Error during temp directory cleanup:", error);
}
}

private async moveFile(src: string, dest: string): Promise<void> {
try {
await fs.rename(src, dest);
} catch (err: any) {
if (err.code === "EXDEV") {
// cross-device: fallback to copy + delete
await fs.copyFile(src, dest);
await fs.unlink(src);
} else {
throw err;
}
}
}
}