From 91a766368194348ecedaef12c416b82ee08b1591 Mon Sep 17 00:00:00 2001 From: Mark M2 Macbook Date: Sat, 9 May 2026 10:20:53 +0200 Subject: [PATCH] f --- lib/features/attachments/data/attachments_repository.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/features/attachments/data/attachments_repository.dart b/lib/features/attachments/data/attachments_repository.dart index 9b86fdf..037db97 100644 --- a/lib/features/attachments/data/attachments_repository.dart +++ b/lib/features/attachments/data/attachments_repository.dart @@ -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"); } }