From 4c99a84d2f86ec1e39415face8179eff7c0446f3 Mon Sep 17 00:00:00 2001 From: "opacity@t-win.kr" Date: Wed, 12 Nov 2025 10:58:32 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=EC=8B=9C=20http=20=3D>=20https=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=ED=95=98=EC=97=AC=20307=EB=A6=AC=EB=94=94=EB=A0=89=EC=85=98=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/CustomImage/CustomImage.jsx | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/com.twin.app.shoptime/src/components/CustomImage/CustomImage.jsx b/com.twin.app.shoptime/src/components/CustomImage/CustomImage.jsx index 53c4ed30..c17cfbc9 100644 --- a/com.twin.app.shoptime/src/components/CustomImage/CustomImage.jsx +++ b/com.twin.app.shoptime/src/components/CustomImage/CustomImage.jsx @@ -31,19 +31,26 @@ export default memo(function CustomImage({ useEffect(() => { const _src = Array.isArray(src) ? src[0] : src; - if (_src && _src !== imgSrc) { + + // HTTP를 HTTPS로 변환 (HSTS 307 리디렉션 방지) + const secureSrc = + _src && typeof _src === "string" && _src.startsWith("http://") + ? _src.replace("http://", "https://") + : _src; + + if (secureSrc && secureSrc !== imgSrc) { if (showImageJob.current) { clearTimeout(showImageJob.current); showImageJob.current = null; } - setImgSrc(_src); + setImgSrc(secureSrc); setError(false); setImageLoaded(false); } - if (!_src) { + if (!secureSrc) { setError(true); } - }, [src]); + }, [src, imgSrc]); useEffect(() => { return () => { @@ -61,13 +68,33 @@ export default memo(function CustomImage({ showImageJob.current = setTimeout(() => { setImageLoaded(true); }, delay); + + // 이미지 로드 성공 카운트 + if (typeof window !== "undefined" && window.__imageLoadStats) { + window.__imageLoadStats.success++; + window.__imageLoadStats.total++; + } + if (onLoad) onLoad(); }, [onLoad, delay]); const _onError = useCallback(() => { setError(true); + + // 이미지 로드 실패 카운트 + if (typeof window !== "undefined" && window.__imageLoadStats) { + window.__imageLoadStats.failed++; + window.__imageLoadStats.total++; + + // 실패한 이미지 URL 저장 + if (!window.__imageLoadStats.failedImages) { + window.__imageLoadStats.failedImages = []; + } + window.__imageLoadStats.failedImages.push(imgSrc); + } + if (onError) onError(); - }, [onError]); + }, [onError, imgSrc]); if (error) { return (