From 3740c60d8975ef04eae2393d7ab78d88eee77bf9 Mon Sep 17 00:00:00 2001 From: Jalen Yan Date: Tue, 3 Mar 2026 11:08:08 +0800 Subject: [PATCH] Fix brace parsing bug in CLASH_DOWNLOAD_URL_TEMPLATE default value The `}` in `{arch}` prematurely closes the `${...:-...}` parameter expansion, causing the default URL to be truncated to `clash-{arch.gz}` instead of `clash-{arch}.gz`. The subsequent `{arch}` replacement then fails silently. Extract the default URL into a separate variable to avoid the nested brace conflict. --- scripts/resolve_clash.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/resolve_clash.sh b/scripts/resolve_clash.sh index 06a7357..d1edb6f 100755 --- a/scripts/resolve_clash.sh +++ b/scripts/resolve_clash.sh @@ -36,7 +36,8 @@ download_clash_bin() { return 1 fi - download_url="${CLASH_DOWNLOAD_URL_TEMPLATE:-https://github.com/Dreamacro/clash/releases/latest/download/clash-{arch}.gz}" + local _default_url="https://github.com/Dreamacro/clash/releases/latest/download/clash-{arch}.gz" + download_url="${CLASH_DOWNLOAD_URL_TEMPLATE:-$_default_url}" if [ -z "$download_url" ]; then echo -e "\033[33m[WARN] 未设置 CLASH_DOWNLOAD_URL_TEMPLATE,跳过 Clash 内核自动下载\033[0m" return 1