merge: recalculate size&hash after web-optimising videos (!1150)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1150

Approved-by: Charlotte <timo.herngreen@gmail.com>
Approved-by: Hazelnoot <acomputerdog@gmail.com>
This commit is contained in:
Hazelnoot 2025-07-26 22:50:08 +00:00
commit 4d64f9e5eb

View file

@ -154,8 +154,8 @@ export class DriveService {
@bindThis
private async save(file: MiDriveFile, path: string, name: string, info: FileInfo): Promise<MiDriveFile> {
const type = info.type.mime;
const hash = info.md5;
const size = info.size;
let hash = info.md5;
let size = info.size;
// thunbnail, webpublic を必要なら生成
const alts = await this.generateAlts(path, type, !file.uri);
@ -163,6 +163,9 @@ export class DriveService {
if (type && type.startsWith('video/')) {
try {
await this.videoProcessingService.webOptimizeVideo(path, type);
const newInfo = await this.fileInfoService.getFileInfo(path);
hash = newInfo.md5;
size = newInfo.size;
} catch (err) {
this.registerLogger.warn(`Video optimization failed: ${renderInlineError(err)}`);
}