From 3a8a5106cd4bb960a50ef93fe9d54bac03c78cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A0=EC=B0=BD=EC=9A=B1?= Date: Sat, 18 Jul 2026 22:34:19 +0900 Subject: [PATCH] fix(cafe24): zip with forward-slash paths (python fallback before Compress-Archive) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On a Windows/Git-Bash build box with no `zip`, the packager fell back to PowerShell Compress-Archive, which writes BACKSLASH path separators. Cafe24's extractor (and some unzip tools) do not normalise them, so the app tree unpacked as flat files (move_detect_app\src\... as a single filename) and the deploy silently broke — a likely cause of the repeated install failures. Prefer a Python zipfile step (POSIX arcnames) between `zip` and PowerShell. Verified: rebuilt zip extracts with a correct move_detect_app/src/... tree and no "backslashes as path separators" warning. --- cloud/deploy/build_cafe24_package.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/cloud/deploy/build_cafe24_package.sh b/cloud/deploy/build_cafe24_package.sh index 04b3adc..7096db5 100755 --- a/cloud/deploy/build_cafe24_package.sh +++ b/cloud/deploy/build_cafe24_package.sh @@ -225,13 +225,30 @@ echo ">> [6/6] zipping" rm -f "$ZIP" if command -v zip >/dev/null 2>&1; then ( cd "$STAGE" && zip -rq "$ZIP" . ) +elif command -v python3 >/dev/null 2>&1; then + # No `zip` (common on Windows/Git Bash). Use Python's zipfile with POSIX (forward-slash) + # arcnames. PowerShell's Compress-Archive writes BACKSLASH path separators, which Cafe24's + # extractor and some unzip tools do NOT normalise — the app tree then unpacks as flat files + # (move_detect_app\src\... as one filename) and the deploy silently breaks. Prefer python. + ( cd "$STAGE" && python3 - "$ZIP" <<'PY' +import os, sys, zipfile +with zipfile.ZipFile(sys.argv[1], "w", zipfile.ZIP_DEFLATED) as z: + for root, _dirs, files in os.walk("."): + for name in files: + full = os.path.join(root, name) + arc = os.path.relpath(full, ".").replace(os.sep, "/") # force forward slashes + z.write(full, arc) +PY + ) elif command -v powershell >/dev/null 2>&1; then - # No zip on the box (common on Windows/Git Bash) — PowerShell ships Compress-Archive. + # Last resort. Compress-Archive uses backslash separators (see above) — the .htaccess/README + # note the operator to extract with a slash-aware tool, or prefer the python path. win_stage="$(cygpath -w "$STAGE" 2>/dev/null || echo "$STAGE")" win_zip="$(cygpath -w "$ZIP" 2>/dev/null || echo "$ZIP")" powershell -NoProfile -Command "Compress-Archive -Path '${win_stage}\\*' -DestinationPath '${win_zip}' -Force" + echo " WARN: archived via Compress-Archive (backslash paths). Verify the host unpacks the tree correctly." else - echo " WARN: no zip/powershell — skipping the archive; upload $STAGE/ directly." + echo " WARN: no zip/python3/powershell — skipping the archive; upload $STAGE/ directly." fi echo ""