From 65754f594b9a2f834246cd4e5ad96161757af1a8 Mon Sep 17 00:00:00 2001 From: thug0bin Date: Mon, 2 Mar 2026 23:52:31 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EA=B5=90?= =?UTF-8?q?=EC=B2=B4=20=EC=8B=9C=20=EB=B0=94=EC=BD=94=EB=93=9C=20=EA=B2=80?= =?UTF-8?q?=EC=A6=9D=20=EA=B0=95=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - openReplaceModal에서 바코드 유효성 검사 - submitReplace에서 null/undefined 바코드 차단 - 디버깅 로그 추가 --- backend/templates/admin_product_images.html | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/backend/templates/admin_product_images.html b/backend/templates/admin_product_images.html index e3abe8d..312e3e8 100644 --- a/backend/templates/admin_product_images.html +++ b/backend/templates/admin_product_images.html @@ -743,6 +743,13 @@ let replaceTargetBarcode = null; function openReplaceModal(barcode, productName) { + console.log('openReplaceModal called with:', barcode, productName); + + if (!barcode || barcode === 'null' || barcode === 'undefined') { + showToast('바코드 정보가 없습니다', 'error'); + return; + } + replaceTargetBarcode = barcode; document.getElementById('replaceProductName').textContent = productName || barcode; document.getElementById('replaceBarcode').textContent = barcode; @@ -769,11 +776,18 @@ return; } + // 바코드 검증 + if (!replaceTargetBarcode || replaceTargetBarcode === 'null' || replaceTargetBarcode === 'undefined') { + showToast('바코드 정보가 없습니다. 다시 시도해주세요.', 'error'); + return; + } + + const barcode = replaceTargetBarcode; closeReplaceModal(); - showToast('이미지 다운로드 중...', 'info'); + showToast(`"${barcode}" 이미지 다운로드 중...`, 'info'); try { - const res = await fetch(`/api/admin/product-images/${replaceTargetBarcode}/replace`, { + const res = await fetch(`/api/admin/product-images/${barcode}/replace`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ image_url: imageUrl })