f
This commit is contained in:
@@ -59,6 +59,12 @@ class AttachmentsRepository {
|
|||||||
required String companyId,
|
required String companyId,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
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 extension = pickedFile.extension ?? pickedFile.name.split('.').last;
|
||||||
final cleanName = pickedFile.name
|
final cleanName = pickedFile.name
|
||||||
.replaceAll(RegExp(r'[^\w\s\.-]'), '')
|
.replaceAll(RegExp(r'[^\w\s\.-]'), '')
|
||||||
@@ -97,7 +103,7 @@ class AttachmentsRepository {
|
|||||||
// 3. Salviamo su Postgres
|
// 3. Salviamo su Postgres
|
||||||
await _supabase.from(_tableName).insert(insertData);
|
await _supabase.from(_tableName).insert(insertData);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw Exception("Errore nel caricamento del file: $e");
|
throw Exception("Errore caricamento: $e");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user