[web-downloads] main: Fix error handling in FetchArtifact
| From: | Shivam Mathur | Date: | Thu, 02 Apr 2026 01:27:53 +0000 |
| Subject: | [web-downloads] main: Fix error handling in FetchArtifact | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-33632@lists.php.net to get a copy of this message | ||
Author: Shivam Mathur (shivammathur)
Date: 2026-04-02T06:09:26+05:30
Commit: https://github.com/php/web-downloads/commit/f6823ed7394b1646f4c4e6541548f8eb07fe9d19
Raw diff: https://github.com/php/web-downloads/commit/f6823ed7394b1646f4c4e6541548f8eb07fe9d19.diff
Fix error handling in FetchArtifact
Changed paths:
M src/Actions/FetchArtifact.php
Diff:
diff --git a/src/Actions/FetchArtifact.php b/src/Actions/FetchArtifact.php
index c8f3203..03b70fd 100644
--- a/src/Actions/FetchArtifact.php
+++ b/src/Actions/FetchArtifact.php
@@ -23,8 +23,13 @@ public function handle($url, $filepath, #[\SensitiveParameter] $token = null): v
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
}
- curl_exec($ch);
+ $result = curl_exec($ch);
+ $error = curl_error($ch);
curl_close($ch);
fclose($fp);
+ if ($result === false) {
+ unlink($filepath);
+ throw new \RuntimeException('cURL error: ' . $error);
+ }
}
}
\ No newline at end of file