From 7ac335974baa44a8575bebb71ae2fbc0902d10e7 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Thu, 26 Jun 2025 13:31:41 +0300 Subject: [PATCH] refactor: Use `DEFAULT_CHARSET` constant instead of hardcoded string (#2011) --- bt/announce.php | 4 ++-- bt/scrape.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bt/announce.php b/bt/announce.php index ea1cca19a..3c74e554f 100644 --- a/bt/announce.php +++ b/bt/announce.php @@ -115,7 +115,7 @@ $stopped = ($event === 'stopped'); // Check info_hash length if (strlen($info_hash) !== 20) { - msg_die('Invalid info_hash: ' . (mb_check_encoding($info_hash, 'UTF8') ? $info_hash : $info_hash_hex)); + msg_die('Invalid info_hash: ' . (mb_check_encoding($info_hash, DEFAULT_CHARSET) ? $info_hash : $info_hash_hex)); } /** @@ -257,7 +257,7 @@ if ($lp_info) { // Verify if torrent registered on tracker and user authorized if (empty($row['topic_id'])) { - msg_die('Torrent not registered, info_hash = ' . (mb_check_encoding($info_hash, 'UTF8') ? $info_hash : $info_hash_hex)); + msg_die('Torrent not registered, info_hash = ' . (mb_check_encoding($info_hash, DEFAULT_CHARSET) ? $info_hash : $info_hash_hex)); } if (empty($row['user_id'])) { msg_die('Please LOG IN and RE-DOWNLOAD this torrent (user not found)'); diff --git a/bt/scrape.php b/bt/scrape.php index dd94ab8ff..d11ea0981 100644 --- a/bt/scrape.php +++ b/bt/scrape.php @@ -32,7 +32,7 @@ $info_hash_hex = bin2hex($info_hash); // Check info_hash length if (strlen($info_hash) !== 20) { - msg_die('Invalid info_hash: ' . (mb_check_encoding($info_hash, 'UTF8') ? $info_hash : $info_hash_hex)); + msg_die('Invalid info_hash: ' . (mb_check_encoding($info_hash, DEFAULT_CHARSET) ? $info_hash : $info_hash_hex)); } // Handle multiple hashes @@ -97,7 +97,7 @@ if (!empty($info_hash_count)) { // Verify if torrent registered on tracker if (empty($torrents)) { - msg_die('Torrent not registered, info_hash = ' . (mb_check_encoding($info_hash, 'UTF8') ? $info_hash : $info_hash_hex)); + msg_die('Torrent not registered, info_hash = ' . (mb_check_encoding($info_hash, DEFAULT_CHARSET) ? $info_hash : $info_hash_hex)); } die(\Arokettu\Bencode\Bencode::encode($torrents));