Skip to content

fix: validate HTTP status code in downloadTemplate to reject non-200 responses#447

Open
DevLikhith5 wants to merge 1 commit into
neutralinojs:mainfrom
DevLikhith5:fix/validate-http-status-download-template-370
Open

fix: validate HTTP status code in downloadTemplate to reject non-200 responses#447
DevLikhith5 wants to merge 1 commit into
neutralinojs:mainfrom
DevLikhith5:fix/validate-http-status-download-template-370

Conversation

@DevLikhith5

Copy link
Copy Markdown

Closes #370.

The Bug

downloadTemplate() pipes the HTTP response directly to a file without checking response.statusCode. A 404 or 500 is silently treated as a successful download.

The Fix

Added a status code check consistent with the pattern already used in downloadClientFromRelease and downloadTypesFromRelease (which were already fixed in an earlier commit):

if(response.statusCode !== 200) {
    file.close();
    reject(new Error(`Failed to download template: HTTP ${response.statusCode}`));
    return;
}

Checklist

  • Conventional Commit (fix:)
  • CHANGELOG updated
  • No new dependencies
  • No modern JS features

…responses

The downloadTemplate function pipes the HTTP response directly to a file without checking response.statusCode. A non-200 response (e.g. 404) is silently treated as a successful download.

Add a status code check consistent with the pattern already used in downloadClientFromRelease and downloadTypesFromRelease (added in a previous fix).

Closes neutralinojs#370
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Downloader functions do not validate HTTP status codes, causing silent download failures

1 participant