v1.2.0: foto produk di kasir (grid + keranjang) + fix MIME jpg->jpeg
This commit is contained in:
@@ -40,12 +40,14 @@ Future<String?> pickAndUploadProductImage(BuildContext context,
|
||||
final raw = picked.name.substring(dot + 1).toLowerCase();
|
||||
if (['jpg', 'jpeg', 'png', 'webp'].contains(raw)) ext = raw;
|
||||
}
|
||||
// MIME resmi: jpg -> image/jpeg (bukan image/jpg, ditolak server 415)
|
||||
final mime = ext == 'jpg' ? 'image/jpeg' : 'image/$ext';
|
||||
final path =
|
||||
'prod-${DateTime.now().millisecondsSinceEpoch}.$ext';
|
||||
await Supabase.instance.client.storage
|
||||
.from(kProductImageBucket)
|
||||
.uploadBinary(path, bytes,
|
||||
fileOptions: FileOptions(contentType: 'image/$ext', upsert: true));
|
||||
fileOptions: FileOptions(contentType: mime, upsert: true));
|
||||
return path;
|
||||
} catch (e) {
|
||||
if (context.mounted) {
|
||||
|
||||
Reference in New Issue
Block a user