1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-26 10:50:29 +02:00

feat(server): support rclone as storage backend (#2832)

This commit is contained in:
cycneuramus 2023-06-19 18:58:10 +02:00 committed by GitHub
parent 9c0f444e4d
commit 296c77ac73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,11 @@ export class FilesystemProvider implements IStorageRepository {
}
async moveFile(source: string, destination: string): Promise<void> {
await moveFile(source, destination, { mkdirp: true, clobber: false });
if (await this.checkFileExists(destination)) {
throw new Error(`Destination file already exists: ${destination}`);
}
await moveFile(source, destination, { mkdirp: true, clobber: true });
}
async checkFileExists(filepath: string, mode = constants.F_OK): Promise<boolean> {