fix: use original filename for upload to allow multiple images per product

32263.heic -> 32263.jpg, 32263-.heic -> 32263-.jpg (non plus les deux 32263.jpg)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-24 19:56:42 +02:00
parent 42989a5ef3
commit 6ca2509ca6
+4 -1
View File
@@ -276,7 +276,10 @@ export function useImages() {
try {
const base64 = await blobToBase64(item.processedBlob)
const filename = `${item.ref}.jpg`
// Utilise le nom de fichier original (sans extension) pour distinguer les images multiples
// ex: "32263.heic" → "32263.jpg", "32263-.heic" → "32263-.jpg"
const basename = item.filename.split('/').pop()?.replace(/\.[^.]+$/, '') ?? item.ref
const filename = `${basename}.jpg`
const res = await fetch('/api/images/upload', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },