From 573c7727988fde27628829f2f7841641474bd7d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B8nstantine=20Kovalensky?= <45331093+kovalensky@users.noreply.github.com> Date: Thu, 21 Dec 2023 20:26:09 +0400 Subject: [PATCH] Use hardcoded dictionary names for better counting result in file listing (#1247) Thanks to @arokettu for pointing this out. --- library/includes/file_list_v2.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/includes/file_list_v2.php b/library/includes/file_list_v2.php index c5db0e2e4..78d949048 100644 --- a/library/includes/file_list_v2.php +++ b/library/includes/file_list_v2.php @@ -50,9 +50,9 @@ if (!is_file($file_path)) { $file_contents = file_get_contents($file_path); if ($bb_cfg['flist_max_files']) { - $filetree_pos = strpos($file_contents, ':file tree'); - $files_pos = !empty($row['info_hash']) ? strpos($file_contents, ':files', $filetree_pos) : false; - $file_count = substr_count($file_contents, ':length', $filetree_pos, ($files_pos ? ($files_pos - $filetree_pos) : null)); + $filetree_pos = strpos($file_contents, '9:file tree'); + $files_pos = !empty($row['info_hash']) ? strpos($file_contents, '5:files', $filetree_pos) : false; + $file_count = substr_count($file_contents, '6:length', $filetree_pos, ($files_pos ? ($files_pos - $filetree_pos) : null)); if ($file_count > $bb_cfg['flist_max_files']) { http_response_code(410);