fix(cafe24): 품목 이미지 주소에 도메인이 두 번 붙어 오는 경우 복구

카페24 GET variants 의 image 가 "https://miras.co.krhttps://cafe24img.poxo.com/
miraskitchen/web/product/extra/big/…" 처럼 쇼핑몰 도메인 뒤에 CDN 전체 주소를
또 붙여 돌려준다(추가이미지를 품목 이미지로 쓴 경우). 그대로 src 에 넣어 깨져
옵션 썸네일이 "없음"으로 보였다. 문자열 안에 http(s):// 가 또 있으면 마지막
주소부터 쓴다.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-28 00:44:20 +09:00
parent 89f055f24b
commit 3882dd7ad3
3 changed files with 9 additions and 1 deletions
@@ -125,7 +125,7 @@
{% endblock %}
{% block scripts %}
<script src="/static/cafe24-options.js?v=20260928b"></script>
<script src="/static/cafe24-options.js?v=20260928c"></script>
<script>
(function () {
var pane = document.getElementById("cf24-editor-pane");
+5
View File
@@ -165,6 +165,11 @@
function imageUrl(path) {
path = String(path || "").trim();
if (!path) return "";
// 카페24 품목 image 가 "https://miras.co.krhttps://cafe24img.poxo.com/…/web/product/extra/big/…"
// 처럼 쇼핑몰 도메인 뒤에 CDN 전체 주소를 한 번 더 붙여 오는 경우가 있다(실물, 추가이미지).
// 안에 주소가 또 있으면 마지막 주소부터 쓴다.
var inner = path.match(/.(https?:\/\/.*)$/i);
if (inner) path = inner[1].replace(/^.*(https?:\/\/)/i, "$1");
if (path.indexOf("//") === 0) return "https:" + path;
if (/^(https?:|data:|blob:)/i.test(path)) return path;
// "/web/product/…" 또는 앞 슬래시 없는 "web/product/…" — 쇼핑몰 주소 기준
+3
View File
@@ -452,6 +452,9 @@ cafe24_oauth_tokens 저장
도메인 없이 저장·응답된다(문서 예제). 화면은 옵션 GET 응답의 `image_base`(=쇼핑몰 주소
`shop_base`)를 붙여 그리고, 카페24에 되보내는 hidden 값은 받은 그대로 둔다. 예전에 이걸
"경로는 있는데 파일이 없다"로 오인해 "없음"으로 표시했다.
- **품목 `image` 는 도메인이 두 번 붙어 올 수 있다**(실물, 추가이미지 `/web/product/extra/big/…`):
`https://miras.co.krhttps://cafe24img.poxo.com/miraskitchen/web/product/extra/big/….jpg`.
화면(`imageUrl`)은 문자열 안에 `http(s)://` 가 또 있으면 마지막 주소부터 쓴다.
- **가격**: `price`(판매가) · `supply_price`(공급가, 문서상 "참조 목적") · `retail_price`
(소비자가). 문자열 `"11000.00"` 형식으로 보낸다(`store.parse_price`). 쇼핑몰 설정의
"판매가 계산 기준"이 상품가(B)면 `price` 대신 `price_excluding_tax` 를 써야 한다는 문서