File tree Expand file tree Collapse file tree 5 files changed +18
-14
lines changed
Expand file tree Collapse file tree 5 files changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ export function getBinaryDownloadUrl(version: string): string {
3939 const arch = process . arch === "arm64" ? "arm64" : "x64" ;
4040 const suffix = process . platform === "win32" ? ".exe" : "" ;
4141
42- return `https://github.com/getsentry/cli/releases/download/v ${ version } /sentry-${ os } -${ arch } ${ suffix } ` ;
42+ return `https://github.com/getsentry/cli/releases/download/${ version } /sentry-${ os } -${ arch } ${ suffix } ` ;
4343}
4444
4545/**
Original file line number Diff line number Diff line change @@ -316,7 +316,7 @@ export async function versionExists(
316316) : Promise < boolean > {
317317 if ( method === "curl" ) {
318318 const response = await fetchWithUpgradeError (
319- `${ GITHUB_RELEASES_URL } /tags/v ${ version } ` ,
319+ `${ GITHUB_RELEASES_URL } /tags/${ version } ` ,
320320 { method : "HEAD" , headers : getGitHubHeaders ( ) } ,
321321 "GitHub"
322322 ) ;
@@ -388,8 +388,12 @@ export async function downloadBinaryToTemp(
388388 ) ;
389389 }
390390
391- // Write to temp file
392- await Bun . write ( tempPath , response ) ;
391+ // Fully consume the response body before writing to disk.
392+ // Bun.write(path, Response) with a large streaming body can exit the
393+ // process before the download completes (Bun event-loop bug).
394+ // Materialising the body first ensures the await keeps the process alive.
395+ const body = await response . arrayBuffer ( ) ;
396+ await Bun . write ( tempPath , body ) ;
393397
394398 // Set executable permission (Unix only)
395399 if ( process . platform !== "win32" ) {
Original file line number Diff line number Diff line change @@ -101,17 +101,17 @@ function mockGitHubVersion(version: string): void {
101101
102102 // GitHub latest release endpoint — returns JSON with tag_name
103103 if ( urlStr . includes ( "releases/latest" ) ) {
104- return new Response ( JSON . stringify ( { tag_name : `v ${ version } ` } ) , {
104+ return new Response ( JSON . stringify ( { tag_name : version } ) , {
105105 status : 200 ,
106106 headers : { "content-type" : "application/json" } ,
107107 } ) ;
108108 }
109109
110- // GitHub tag check (for versionExists)
111- if ( urlStr . includes ( "/releases/tag /" ) ) {
112- const requested = urlStr . split ( "/releases/tag/v " ) [ 1 ] ;
110+ // GitHub tag check (for versionExists) — this repo uses un-prefixed tags
111+ if ( urlStr . includes ( "/releases/tags /" ) ) {
112+ const requested = urlStr . split ( "/releases/tags/ " ) [ 1 ] ;
113113 if ( requested === version ) {
114- return new Response ( JSON . stringify ( { tag_name : `v ${ version } ` } ) , {
114+ return new Response ( JSON . stringify ( { tag_name : version } ) , {
115115 status : 200 ,
116116 headers : { "content-type" : "application/json" } ,
117117 } ) ;
Original file line number Diff line number Diff line change @@ -31,9 +31,9 @@ describe("getBinaryDownloadUrl", () => {
3131 test ( "builds correct URL for current platform" , ( ) => {
3232 const url = getBinaryDownloadUrl ( "1.0.0" ) ;
3333
34- expect ( url ) . toContain ( "/v1 .0.0/" ) ;
34+ expect ( url ) . toContain ( "/1 .0.0/" ) ;
3535 expect ( url ) . toStartWith (
36- "https://github.com/getsentry/cli/releases/download/v "
36+ "https://github.com/getsentry/cli/releases/download/"
3737 ) ;
3838 expect ( url ) . toContain ( "sentry-" ) ;
3939
Original file line number Diff line number Diff line change @@ -437,10 +437,10 @@ describe("getBinaryDownloadUrl", () => {
437437 test ( "builds correct URL for current platform" , ( ) => {
438438 const url = getBinaryDownloadUrl ( "1.0.0" ) ;
439439
440- // URL should contain the version with 'v' prefix (GitHub tag format)
441- expect ( url ) . toContain ( "/v1 .0.0/" ) ;
440+ // URL should contain the version without 'v' prefix (this repo's tag format)
441+ expect ( url ) . toContain ( "/1 .0.0/" ) ;
442442 expect ( url ) . toStartWith (
443- "https://github.com/getsentry/cli/releases/download/v "
443+ "https://github.com/getsentry/cli/releases/download/"
444444 ) ;
445445 expect ( url ) . toContain ( "sentry-" ) ;
446446
You can’t perform that action at this time.
0 commit comments