upd flip check

This commit is contained in:
Marie 2025-03-28 00:46:23 +01:00
parent 6dae5c9165
commit a35bfa9f1a
No known key found for this signature in database
GPG key ID: 7ADF6C9CD9A28555

View file

@ -407,7 +407,9 @@ export class DriveService {
); );
if (this.meta.objectStorageSetPublicRead) params.ACL = 'public-read'; if (this.meta.objectStorageSetPublicRead) params.ACL = 'public-read';
if (!this.meta.objectStorageEndpoint?.includes('bunnycdn.com')) { if (this.meta.objectStorageEndpoint && this.meta.objectStorageEndpoint.includes('bunnycdn.com')) {
await this.bunnyService.upload(this.meta, key, stream);
} else {
await this.s3Service.upload(this.meta, params) await this.s3Service.upload(this.meta, params)
.then( .then(
result => { result => {
@ -422,8 +424,6 @@ export class DriveService {
this.registerLogger.error(`Upload Failed: key = ${key}, filename = ${filename}`, err); this.registerLogger.error(`Upload Failed: key = ${key}, filename = ${filename}`, err);
}, },
); );
} else {
await this.bunnyService.upload(this.meta, key, stream);
} }
} }
@ -820,10 +820,10 @@ export class DriveService {
Bucket: this.meta.objectStorageBucket, Bucket: this.meta.objectStorageBucket,
Key: key, Key: key,
} as DeleteObjectCommandInput; } as DeleteObjectCommandInput;
if (!this.meta.objectStorageEndpoint?.includes('bunnycdn.com')) { if (this.meta.objectStorageEndpoint && this.meta.objectStorageEndpoint.includes('bunnycdn.com')) {
await this.s3Service.delete(this.meta, param);
} else {
await this.bunnyService.delete(this.meta, key); await this.bunnyService.delete(this.meta, key);
} else {
await this.s3Service.delete(this.meta, param);
} }
} catch (err: any) { } catch (err: any) {
if (err.name === 'NoSuchKey') { if (err.name === 'NoSuchKey') {