$tempFile = tempnam(sys_get_temp_dir(), 'bs-cli-vendor-zip');
$targetUrl = "https://files.bookstackapp.com/vendor/{$version}.zip";
- file_put_contents($tempFile, fopen($targetUrl, 'rb'));
+ $targetFile = @fopen($targetUrl, 'rb');
+ if ($targetFile === false) {
+ throw new CommandError("Failed to download ZIP file from $targetUrl");
+ }
+
+ file_put_contents($tempFile, $targetFile);
return $tempFile;
}