mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2025-01-10 06:57:52 +00:00
add torrent file validation
This commit is contained in:
parent
5aa20e6a22
commit
f919a7ed85
@ -45,7 +45,7 @@ class TorrentController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read file
|
// Read file
|
||||||
if (!$file = $torrentService->readTorrentFileById($torrent->getId()))
|
if (!$file = $torrentService->readTorrentFileByTorrentId($torrent->getId()))
|
||||||
{
|
{
|
||||||
throw $this->createNotFoundException();
|
throw $this->createNotFoundException();
|
||||||
}
|
}
|
||||||
|
@ -32,14 +32,22 @@ class TorrentService
|
|||||||
// Tools
|
// Tools
|
||||||
public function readTorrentFileByFilepath(
|
public function readTorrentFileByFilepath(
|
||||||
string $filepath
|
string $filepath
|
||||||
): \Rhilip\Bencode\TorrentFile
|
): ?\Rhilip\Bencode\TorrentFile
|
||||||
{
|
{
|
||||||
return \Rhilip\Bencode\TorrentFile::load(
|
try
|
||||||
$filepath
|
{
|
||||||
);
|
return \Rhilip\Bencode\TorrentFile::load(
|
||||||
|
$filepath
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
catch (\Rhilip\Bencode\ParseException $error)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readTorrentFileById(
|
public function readTorrentFileByTorrentId(
|
||||||
int $id
|
int $id
|
||||||
): \Rhilip\Bencode\TorrentFile
|
): \Rhilip\Bencode\TorrentFile
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user