[web-downloads] main: Check HTTP status code in FetchArtifact

From: Date: Thu, 02 Apr 2026 01:28:38 +0000
Subject: [web-downloads] main: Check HTTP status code in FetchArtifact
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-33643@lists.php.net to get a copy of this message
Author: Shivam Mathur (shivammathur) Date: 2026-04-02T06:55:38+05:30 Commit: https://github.com/php/web-downloads/commit/7b7ee8e4655e5ea5e631d3a995aeb881ae6fc1e2 Raw diff: https://github.com/php/web-downloads/commit/7b7ee8e4655e5ea5e631d3a995aeb881ae6fc1e2.diff Check HTTP status code in FetchArtifact Changed paths: M src/Actions/FetchArtifact.php Diff: diff --git a/src/Actions/FetchArtifact.php b/src/Actions/FetchArtifact.php index 03b70fd..d2d1a60 100644 --- a/src/Actions/FetchArtifact.php +++ b/src/Actions/FetchArtifact.php @@ -25,11 +25,16 @@ public function handle($url, $filepath, #[\SensitiveParameter] $token = null): v } $result = curl_exec($ch); $error = curl_error($ch); + $httpCode = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); fclose($fp); if ($result === false) { unlink($filepath); throw new \RuntimeException('cURL error: ' . $error); } + if ($httpCode >= 400) { + unlink($filepath); + throw new \RuntimeException('HTTP error: ' . $httpCode); + } } } \ No newline at end of file

« previous php.webmaster (#33643) next »