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:
@@ -276,7 +276,10 @@ export function useImages() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const base64 = await blobToBase64(item.processedBlob)
|
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', {
|
const res = await fetch('/api/images/upload', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
|||||||
Reference in New Issue
Block a user