@@ -35,31 +35,36 @@ function util:GetDownloadInfo(version)
3535 return nil , " Unsupported OS type: " .. os_type
3636 end
3737
38- local file_name = string.format (" chaosblade-%s-%s-%s.tar.gz" , version , os_type , arch )
38+ -- Remove 'v' prefix from version for filename
39+ local clean_version = version :gsub (" ^v" , " " )
40+ local file_name = string.format (" chaosblade-%s-%s-%s.tar.gz" , clean_version , os_type , arch )
3941 local url = string.format (" https://github.com/chaosblade-io/chaosblade/releases/download/%s/%s" , version , file_name )
4042
4143 local checksum_url = string.format (" https://github.com/chaosblade-io/chaosblade/releases/download/%s/checksum.txt" , version )
4244 local code , body = http .get (checksum_url )
43- if code ~= 200 then
44- return nil , " Failed to fetch checksum file."
45- end
46-
4745 local checksum = " "
48- for line in string.gmatch (body , " [^\r\n ]+" ) do
49- local sha , name = line :match (" ([a-f0-9]+)%s+(.+)" )
50- if name == file_name then
51- checksum = sha
52- break
46+
47+ -- Try to get checksum if available, but don't fail if not found
48+ if code == 200 then
49+ for line in string.gmatch (body , " [^\r\n ]+" ) do
50+ local sha , name = line :match (" ([a-f0-9]+)%s+(.+)" )
51+ if name == file_name then
52+ checksum = sha
53+ break
54+ end
5355 end
5456 end
55- if checksum == " " then
56- return nil , " Failed to find checksum for " .. file_name
57- end
58-
59- return {
60- url = url ,
61- sha256 = checksum
57+
58+ -- Return the download info, with or without checksum
59+ local result = {
60+ url = url
6261 }
62+
63+ if checksum ~= " " then
64+ result .sha256 = checksum
65+ end
66+
67+ return result
6368end
6469
6570return util
0 commit comments