Skip to content

Commit b35dde3

Browse files
fix the CI
1 parent 7a47d5c commit b35dde3

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

cmake/LiveKitSDK.cmake

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,32 @@ function(_lk_resolve_latest_version out_version repo download_dir github_token)
6565
file(MAKE_DIRECTORY "${download_dir}")
6666

6767
set(_api "https://api.github.com/repos/${repo}/releases/latest")
68-
set(_json "${download_dir}/livekit_latest_release_${repo}.json")
69-
string(REPLACE "/" "_" _json "${_json}") # sanitize filename
7068

71-
set(_headers "User-Agent: cmake-livekit-sdk/1.0")
69+
# Sanitize only the repo part (NOT the whole path)
70+
string(REPLACE "/" "_" _repo_sanitized "${repo}")
71+
set(_json "${download_dir}/livekit_latest_release_${_repo_sanitized}.json")
72+
73+
# Build headers as a proper argument list (quoted per header)
74+
set(_headers
75+
"User-Agent: cmake-livekit-sdk/1.0"
76+
"Accept: application/vnd.github+json"
77+
)
7278
if(NOT "${github_token}" STREQUAL "")
7379
list(APPEND _headers "Authorization: Bearer ${github_token}")
7480
endif()
7581

76-
file(DOWNLOAD
77-
"${_api}" "${_json}"
82+
# Pass headers safely: keep each header as ONE argument
83+
set(_download_args
7884
TLS_VERIFY ON
79-
HTTPHEADER ${_headers}
8085
STATUS _st
8186
)
87+
list(APPEND _download_args HTTPHEADER)
88+
foreach(h IN LISTS _headers)
89+
list(APPEND _download_args "${h}")
90+
endforeach()
91+
92+
file(DOWNLOAD "${_api}" "${_json}" ${_download_args})
93+
8294
list(GET _st 0 _code)
8395
list(GET _st 1 _msg)
8496
if(NOT _code EQUAL 0)
@@ -104,6 +116,7 @@ function(_lk_resolve_latest_version out_version repo download_dir github_token)
104116
set(${out_version} "${_ver}" PARENT_SCOPE)
105117
endfunction()
106118

119+
107120
# Public:
108121
# livekit_sdk_setup(
109122
# VERSION <ver|latest>

0 commit comments

Comments
 (0)