mirror of
https://github.com/wnlen/clash-for-linux.git
synced 2026-03-21 22:06:45 +08:00
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.
This commit is contained in:
@ -36,7 +36,8 @@ download_clash_bin() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
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
|
if [ -z "$download_url" ]; then
|
||||||
echo -e "\033[33m[WARN] 未设置 CLASH_DOWNLOAD_URL_TEMPLATE,跳过 Clash 内核自动下载\033[0m"
|
echo -e "\033[33m[WARN] 未设置 CLASH_DOWNLOAD_URL_TEMPLATE,跳过 Clash 内核自动下载\033[0m"
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
Reference in New Issue
Block a user