fix curl grammer 3
This commit is contained in:
16
gitea.sh
16
gitea.sh
@ -198,10 +198,11 @@ fetch_file_list() {
|
||||
download_file() {
|
||||
local full_repo_name="$1"
|
||||
local file_path="$2"
|
||||
local owner_repo=(${full_repo_name//// })
|
||||
local owner=${owner_repo[0]}
|
||||
local repo_name=${owner_repo[1]}
|
||||
|
||||
# 使用 IFS 和 read for robust splitting, avoiding global IFS issues.
|
||||
local owner
|
||||
local repo_name
|
||||
IFS='/' read -r owner repo_name <<< "$full_repo_name"
|
||||
|
||||
local output_file
|
||||
output_file=$(basename "${file_path}")
|
||||
# 兼容 Windows,替换路径中的 / 为 \ (虽然 curl 可能不需要)
|
||||
@ -209,13 +210,6 @@ download_file() {
|
||||
|
||||
local download_url="${GITEA_URL}/api/v1/repos/${owner}/${repo_name}/raw/${file_path}"
|
||||
|
||||
# --- 增加的调试代码 ---
|
||||
info "--- DEBUG START ---"
|
||||
info "正在构建的 URL 如下:"
|
||||
# 使用 printf "%q" 可以更安全地打印变量,显示特殊字符
|
||||
printf "URL: %q\n" "${download_url}"
|
||||
info "--- DEBUG END ---"
|
||||
|
||||
info "正在下载 '${file_path}'..."
|
||||
curl -L --progress-bar --fail \
|
||||
-H "Authorization: token ${ACCESS_TOKEN}" \
|
||||
|
||||
Reference in New Issue
Block a user