prevend duplicates upload by md5 file check #11

This commit is contained in:
ghost 2023-10-10 15:21:16 +03:00
parent bd772f87d1
commit 1f7d8d0810
3 changed files with 35 additions and 0 deletions

View file

@ -257,6 +257,12 @@ class TorrentController extends AbstractController
$form['torrent']['error'][] = $translator->trans('Torrent file out of size limit');
}
//// Check for duplicates
if ($torrentService->findTorrentByMd5File(md5_file($file->getPathName())))
{
$form['torrent']['error'][] = $translator->trans('Torrent file already exists');
}
//// Validate torrent format
if (!$torrentService->readTorrentFileByFilepath($file->getPathName()))
{