perf: add database indexes, implement caching, enforce permission guards, and sanitize external URLs
Build and Push Multi-Platform Images / build-and-push (push) Successful in 48s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 48s
This commit is contained in:
@@ -44,20 +44,21 @@ export class EmailImportService {
|
||||
const hasPreview = await this.pageCache.hasPreview(attachment.Id, 1);
|
||||
if (!hasPreview && attachment.Content?.Content1) {
|
||||
this.logger.log(`Generiere fehlende Vorschaubilder für Anhang ${attachment.Id} (Email ${emailId})`);
|
||||
const tempPdfPath = path.join(os.tmpdir(), `email-att-gen-${attachment.Id}.pdf`);
|
||||
try {
|
||||
const tempPdfPath = path.join(os.tmpdir(), `email-att-gen-${attachment.Id}.pdf`);
|
||||
await fs.writeFile(tempPdfPath, attachment.Content.Content1);
|
||||
|
||||
|
||||
const images = await this.pdfService.pdfToImages(tempPdfPath, 400);
|
||||
await this.pageCache.generate(attachment.Id, images);
|
||||
|
||||
|
||||
attachment.PageCount = images.length;
|
||||
await this.attachmentRepo.save(attachment);
|
||||
|
||||
|
||||
await this.pdfService.cleanup(images);
|
||||
await fs.unlink(tempPdfPath).catch(() => {});
|
||||
} catch (err: any) {
|
||||
this.logger.warn(`Fehler bei on-demand Vorschau-Generierung für Anhang ${attachment.Id}: ${err.message}`);
|
||||
} finally {
|
||||
await fs.unlink(tempPdfPath).catch(() => {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user