Exception handling for Bencode errors (#1239)

This commit is contained in:
Cønstantine Kovalensky 2023-12-20 21:46:49 +04:00 committed by GitHub
commit 586fc0b563
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 7 deletions

View file

@ -30,9 +30,9 @@ 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) {
return $lang['TORFILE_INVALID'];
} catch (Exception) {
$this->response['html'] = $lang['TORFILE_INVALID'];
return;
}
$torrent = new TorrentPier\Legacy\TorrentFileList($tor);