vboxes fix

This commit is contained in:
2026-03-19 14:28:09 +01:00
parent b7f7c1f7c0
commit 06dfbfcbc4
30 changed files with 4405 additions and 166 deletions
+33
View File
@@ -180,6 +180,39 @@ async def upload_outbound_eml(
raise
async def download_attachment(storage_path: str) -> bytes:
"""
Scarica un allegato da MinIO e restituisce i byte.
Args:
storage_path: percorso oggetto MinIO (senza bucket name)
Returns:
Byte del file scaricato
Raises:
Exception: se il download fallisce
"""
client = get_minio_client()
bucket = settings.minio_bucket
try:
response = await client.get_object(
bucket_name=bucket,
object_name=storage_path,
)
data = await response.read()
response.close()
await response.release()
logger.debug(
f"Allegato scaricato: s3://{bucket}/{storage_path} ({len(data)} bytes)"
)
return data
except Exception as e:
logger.error(f"Errore download allegato {storage_path}: {e}")
raise
async def ensure_bucket_exists() -> None:
"""Verifica che il bucket MinIO esista, altrimenti lo crea."""
client = get_minio_client()