From 9af71172066a973bbfe4a90ea6ee7064bbdb1d7f Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 8 Oct 2023 02:05:56 +0300 Subject: [PATCH] update torrent library --- src/Controller/PageController.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Controller/PageController.php b/src/Controller/PageController.php index 6c7e501..bb7c7ed 100644 --- a/src/Controller/PageController.php +++ b/src/Controller/PageController.php @@ -188,15 +188,21 @@ class PageController extends AbstractController continue; } - if (empty($torrentService->getTorrentInfoNameByFilepath($file->getPathName()))) + //// Validate torrent format + try { - $form['torrent']['error'][] = $translator->trans('Could not parse torrent file'); + \Rhilip\Bencode\TorrentFile::load( + $file->getPathName() + ); + } - continue; + catch (ParseException $e) + { + $form['torrents']['error'][] = $translator->trans('Could not parse torrent file'); } //// Content - $torrent = $torrentService->submit( + $torrent = $torrentService->add( $file->getPathName(), $user->getId(), time(),