Skip to content

Commit

Permalink
add exception if no download files
Browse files Browse the repository at this point in the history
  • Loading branch information
marat2509 committed Mar 8, 2024
1 parent 6448b7f commit 6cf2383
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions worker/core/inc/classes/Mirror.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ static public function download_update_ver($mirror, $downloadRandomFile = false)
if (preg_match_all('#\[\w+\][^\[]+#', $content, $matches))
{
list($new_files, $total_size, $new_content) = static::parse_update_file($matches[0]);
# add error if no files for download
if (count($new_files) == 0) throw new ToolsException(Language::t("No files to download"), 1);
$new_files = array_filter($new_files, function($v, $k) {
return $v['size'] <= 1024 * 1024;
}, ARRAY_FILTER_USE_BOTH);
Expand Down Expand Up @@ -472,8 +474,8 @@ static protected function parse_update_file($matches)

if (empty($output['file']) or empty($output['size']) or
(static::$ESET['x32'] != 1 and preg_match("/32|86/", $output['platform'])) or
(static::$ESET['x64'] != 1 and preg_match("/(?<!a)64/", $output['platform'])) or
(static::$ESET['arm64'] != 1 and preg_match("/a64/", $output['platform']))
(static::$ESET['arm64'] != 1 and preg_match("/a64/", $output['platform'])) or
(static::$ESET['x64'] != 1 and preg_match("/64/", $output['platform']))
) continue;
$new_files[] = $output;
$total_size += $output['size'];
Expand Down

0 comments on commit 6cf2383

Please sign in to comment.