mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 12:36:57 +00:00
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1115 Closes #697 Approved-by: Marie <github@yuugi.dev> Approved-by: dakkar <dakkar@thenautilus.net>
This commit is contained in:
commit
a9a7e4b9d0
1 changed files with 19 additions and 25 deletions
|
@ -164,7 +164,7 @@ export class DriveService {
|
||||||
try {
|
try {
|
||||||
await this.videoProcessingService.webOptimizeVideo(path, type);
|
await this.videoProcessingService.webOptimizeVideo(path, type);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.registerLogger.warn(`Video optimization failed: ${err instanceof Error ? err.message : String(err)}`, { error: err });
|
this.registerLogger.warn(`Video optimization failed: ${renderInlineError(err)}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ export class DriveService {
|
||||||
this.registerLogger.debug('web image not created (not an required image)');
|
this.registerLogger.debug('web image not created (not an required image)');
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.registerLogger.warn('web image not created (an error occurred)', err as Error);
|
this.registerLogger.warn(`web image not created: ${renderInlineError(err)}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (satisfyWebpublic) this.registerLogger.debug('web image not created (original satisfies webpublic)');
|
if (satisfyWebpublic) this.registerLogger.debug('web image not created (original satisfies webpublic)');
|
||||||
|
@ -386,7 +386,7 @@ export class DriveService {
|
||||||
thumbnail = await this.imageProcessingService.convertSharpToWebp(img, 498, 422);
|
thumbnail = await this.imageProcessingService.convertSharpToWebp(img, 498, 422);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.registerLogger.warn('thumbnail not created (an error occurred)', err as Error);
|
this.registerLogger.warn(`Error creating thumbnail: ${renderInlineError(err)}`);
|
||||||
}
|
}
|
||||||
// #endregion thumbnail
|
// #endregion thumbnail
|
||||||
|
|
||||||
|
@ -420,27 +420,21 @@ export class DriveService {
|
||||||
);
|
);
|
||||||
if (this.meta.objectStorageSetPublicRead) params.ACL = 'public-read';
|
if (this.meta.objectStorageSetPublicRead) params.ACL = 'public-read';
|
||||||
|
|
||||||
|
try {
|
||||||
if (this.bunnyService.usingBunnyCDN(this.meta)) {
|
if (this.bunnyService.usingBunnyCDN(this.meta)) {
|
||||||
await this.bunnyService.upload(this.meta, key, stream).catch(
|
await this.bunnyService.upload(this.meta, key, stream);
|
||||||
err => {
|
|
||||||
this.registerLogger.error(`Upload Failed: key = ${key}, filename = ${filename}`, err);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
await this.s3Service.upload(this.meta, params)
|
const result = await this.s3Service.upload(this.meta, params);
|
||||||
.then(
|
|
||||||
result => {
|
|
||||||
if ('Bucket' in result) { // CompleteMultipartUploadCommandOutput
|
if ('Bucket' in result) { // CompleteMultipartUploadCommandOutput
|
||||||
this.registerLogger.debug(`Uploaded: ${result.Bucket}/${result.Key} => ${result.Location}`);
|
this.registerLogger.debug(`Uploaded: ${result.Bucket}/${result.Key} => ${result.Location}`);
|
||||||
} else { // AbortMultipartUploadCommandOutput
|
} else { // AbortMultipartUploadCommandOutput
|
||||||
this.registerLogger.error(`Upload Result Aborted: key = ${key}, filename = ${filename}`);
|
this.registerLogger.error(`Upload Result Aborted: key = ${key}, filename = ${filename}`);
|
||||||
|
throw new Error('S3 upload aborted');
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
.catch(
|
} catch (err) {
|
||||||
err => {
|
this.registerLogger.error(`Upload Failed: key = ${key}, filename = ${filename}: ${renderInlineError(err)}`);
|
||||||
this.registerLogger.error(`Upload Failed: key = ${key}, filename = ${filename}`, err);
|
throw err;
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -857,7 +851,7 @@ export class DriveService {
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
if (err.name === 'NoSuchKey') {
|
if (err.name === 'NoSuchKey') {
|
||||||
this.deleteLogger.warn(`The object storage had no such key to delete: ${key}. Skipping this.`, err as Error);
|
this.deleteLogger.warn(`The object storage had no such key to delete: ${key}. Skipping this.`);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Failed to delete the file from the object storage with the given key: ${key}`, {
|
throw new Error(`Failed to delete the file from the object storage with the given key: ${key}`, {
|
||||||
|
|
Loading…
Add table
Reference in a new issue