diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index b8e2115..00af35d 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -4395,17 +4395,21 @@ function InspectionModal({ checklist, existingInspection, user, onClose, onCompl if (response.ok) { const savedAnswer = await response.json() - // Upload photos if any + // Upload photos if any - Solo subir archivos nuevos (File/Blob), no URLs existentes if (answer.photos.length > 0) { for (const photoFile of answer.photos) { - const formData = new FormData() - formData.append('file', photoFile) - - await fetch(`${API_URL}/api/answers/${savedAnswer.id}/upload`, { - method: 'POST', - headers: { 'Authorization': `Bearer ${token}` }, - body: formData - }) + // Verificar si es un archivo nuevo y no una URL de foto ya subida + if (photoFile instanceof File || photoFile instanceof Blob) { + const formData = new FormData() + formData.append('file', photoFile) + + await fetch(`${API_URL}/api/answers/${savedAnswer.id}/upload`, { + method: 'POST', + headers: { 'Authorization': `Bearer ${token}` }, + body: formData + }) + } + // Si es string (URL), ya está subida, no hacer nada } }