Fix issues related to file list display and torrent registration (#1028)

Bencoding libraries properties changed in the new version
This commit is contained in:
Cønstantine Kovalensky 2023-11-04 09:56:31 +04:00 committed by GitHub
commit 5d872e3555
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 19 deletions

View file

@ -32,14 +32,12 @@ if (!file_exists($filename) || !$file_contents = file_get_contents($filename)) {
}
}
if (!$tor = \Arokettu\Bencode\Bencode::decode($file_contents)) {
if (!$tor = \Arokettu\Bencode\Bencode::decode($file_contents, dictType: \Arokettu\Bencode\Bencode\Collection::ARRAY)) {
return $lang['TORFILE_INVALID'];
}
$torrent = new TorrentPier\Legacy\TorrentFileList($tor);
if (($tor['info']['meta version'] ?? null) == 2) {
$tor_filelist = $torrent->fileTreeList($tor['info']['file tree'], $tor['info']['name'] ?? ''); // v2
} else {
$tor_filelist = $torrent->get_filelist(); // v1
}
$tor_filelist = $torrent->get_filelist();
$this->response['html'] = $tor_filelist;