From fbc4749ca9d8ce7ee5d6f29eebf2c5fddfc7bada 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 09:10:34 +0400 Subject: [PATCH] Little improvements (#1244) --- library/ajax/view_torrent.php | 2 +- library/includes/file_list_v2.php | 2 +- src/Legacy/Attach.php | 5 +---- src/Legacy/Torrent.php | 4 ++-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/library/ajax/view_torrent.php b/library/ajax/view_torrent.php index d0afdeb37..53625a63c 100644 --- a/library/ajax/view_torrent.php +++ b/library/ajax/view_torrent.php @@ -31,7 +31,7 @@ if (!file_exists($filename) || !$file_contents = file_get_contents($filename)) { try { $tor = \Arokettu\Bencode\Bencode::decode($file_contents, dictType: \Arokettu\Bencode\Bencode\Collection::ARRAY); } catch (\Exception $e) { - $this->response['html'] = $lang['TORFILE_INVALID']; + $this->response['html'] = htmlCHR("{$lang['TORFILE_INVALID']}: {$e->getMessage()}"); return; } diff --git a/library/includes/file_list_v2.php b/library/includes/file_list_v2.php index 0d40072ef..c5db0e2e4 100644 --- a/library/includes/file_list_v2.php +++ b/library/includes/file_list_v2.php @@ -64,7 +64,7 @@ try { $torrent = \Arokettu\Bencode\Bencode::decode($file_contents, dictType: \Arokettu\Bencode\Bencode\Collection::ARRAY); } catch (\Exception $e) { http_response_code(410); - die($lang['TORFILE_INVALID']); + die(htmlCHR("{$lang['TORFILE_INVALID']}: {$e->getMessage()}")); } if (isset($torrent['info']['private']) && IS_GUEST) { diff --git a/src/Legacy/Attach.php b/src/Legacy/Attach.php index 691d39eaa..8b4c275be 100644 --- a/src/Legacy/Attach.php +++ b/src/Legacy/Attach.php @@ -740,7 +740,7 @@ class Attach bb_die('No file content sent'); break; case UPLOAD_ERR_INI_SIZE: - bb_die('upload_max_filesize setting: ' . ini_get('upload_max_filesize')); + bb_die('php.ini
upload_max_filesize setting: ' . ini_get('upload_max_filesize')); break; case UPLOAD_ERR_FORM_SIZE: bb_die('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'); @@ -757,9 +757,6 @@ class Attach case UPLOAD_ERR_NO_TMP_DIR: bb_die('Missing a temporary folder'); break; - default: - bb_die('Unknown upload error'); - break; } } diff --git a/src/Legacy/Torrent.php b/src/Legacy/Torrent.php index 4bf44e428..e4aa10bd8 100644 --- a/src/Legacy/Torrent.php +++ b/src/Legacy/Torrent.php @@ -320,7 +320,7 @@ class Torrent try { $tor = \Arokettu\Bencode\Bencode::decode($file_contents, dictType: \Arokettu\Bencode\Bencode\Collection::ARRAY); } catch (\Exception $e) { - self::torrent_error_exit($lang['TORFILE_INVALID']); + self::torrent_error_exit(htmlCHR("{$lang['TORFILE_INVALID']}: {$e->getMessage()}")); } if ($bb_cfg['bt_disable_dht']) { @@ -564,7 +564,7 @@ class Torrent try { $tor = \Arokettu\Bencode\Bencode::decode($file_contents, dictType: \Arokettu\Bencode\Bencode\Collection::ARRAY); } catch (\Exception $e) { - bb_die($lang['TORFILE_INVALID']); + bb_die(htmlCHR("{$lang['TORFILE_INVALID']}: {$e->getMessage()}")); } // Get tracker announcer