This commit is contained in:
2026-05-09 10:20:53 +02:00
parent 302bec114f
commit 91a7663681

View File

@@ -59,6 +59,12 @@ class AttachmentsRepository {
required String companyId,
}) async {
try {
if (pickedFile.bytes == null) {
throw Exception(
"I bytes del file sono vuoti! Ricarica la pagina senza cache.",
);
}
final extension = pickedFile.extension ?? pickedFile.name.split('.').last;
final cleanName = pickedFile.name
.replaceAll(RegExp(r'[^\w\s\.-]'), '')
@@ -97,7 +103,7 @@ class AttachmentsRepository {
// 3. Salviamo su Postgres
await _supabase.from(_tableName).insert(insertData);
} catch (e) {
throw Exception("Errore nel caricamento del file: $e");
throw Exception("Errore caricamento: $e");
}
}