Browse Source

unify torrent filenames to prevent encoding issues on FTP connection

main
ghost 1 year ago
parent
commit
258d206f2e
  1. 47
      src/Controller/TorrentController.php

47
src/Controller/TorrentController.php

@ -2538,11 +2538,8 @@ class TorrentController extends AbstractController
$response->headers->set( $response->headers->set(
'Content-Disposition', 'Content-Disposition',
sprintf( sprintf(
'attachment; filename="wanted#%s.%s.torrent";', 'attachment; filename="wanted#%s.torrent";',
$torrent->getId(), $torrent->getId()
mb_strtolower(
$file->getName()
)
) )
); );
@ -2784,10 +2781,9 @@ class TorrentController extends AbstractController
$torrentService->copyToFtpStorage( $torrentService->copyToFtpStorage(
$torrent->getId(), $torrent->getId(),
sprintf( sprintf(
'%s/torrents/wanted/all/wanted#%s.%s.torrent', '%s/torrents/wanted/all/wanted#%s.torrent',
$this->getParameter('app.torrent.wanted.ftp.folder'), $this->getParameter('app.torrent.wanted.ftp.folder'),
$torrent->getId(), $torrent->getId()
$file->getName()
) )
); );
@ -2797,10 +2793,9 @@ class TorrentController extends AbstractController
$torrentService->copyToFtpStorage( $torrentService->copyToFtpStorage(
$torrent->getId(), $torrent->getId(),
sprintf( sprintf(
'%s/torrents/wanted/sensitive/yes/wanted#%s.%s.torrent', '%s/torrents/wanted/sensitive/yes/wanted#%s.torrent',
$this->getParameter('app.torrent.wanted.ftp.folder'), $this->getParameter('app.torrent.wanted.ftp.folder'),
$torrent->getId(), $torrent->getId()
$file->getName()
) )
); );
} }
@ -2810,10 +2805,9 @@ class TorrentController extends AbstractController
$torrentService->copyToFtpStorage( $torrentService->copyToFtpStorage(
$torrent->getId(), $torrent->getId(),
sprintf( sprintf(
'%s/torrents/wanted/sensitive/no/wanted#%s.%s.torrent', '%s/torrents/wanted/sensitive/no/wanted#%s.torrent',
$this->getParameter('app.torrent.wanted.ftp.folder'), $this->getParameter('app.torrent.wanted.ftp.folder'),
$torrent->getId(), $torrent->getId()
$file->getName()
) )
); );
} }
@ -2824,11 +2818,10 @@ class TorrentController extends AbstractController
$torrentService->copyToFtpStorage( $torrentService->copyToFtpStorage(
$torrent->getId(), $torrent->getId(),
sprintf( sprintf(
'%s/torrents/wanted/locale/%s/wanted#%s.%s.torrent', '%s/torrents/wanted/locale/%s/wanted#%s.torrent',
$this->getParameter('app.torrent.wanted.ftp.folder'), $this->getParameter('app.torrent.wanted.ftp.folder'),
$locale, $locale,
$torrent->getId(), $torrent->getId()
$file->getName()
) )
); );
} }
@ -2841,29 +2834,26 @@ class TorrentController extends AbstractController
/// All /// All
$torrentService->removeFromFtpStorage( $torrentService->removeFromFtpStorage(
sprintf( sprintf(
'%s/torrents/wanted/all/wanted#%s.%s.torrent', '%s/torrents/wanted/all/wanted#%s.torrent',
$this->getParameter('app.torrent.wanted.ftp.folder'), $this->getParameter('app.torrent.wanted.ftp.folder'),
$torrent->getId(), $torrent->getId()
$file->getName()
) )
); );
/// Sensitive /// Sensitive
$torrentService->removeFromFtpStorage( $torrentService->removeFromFtpStorage(
sprintf( sprintf(
'%s/torrents/wanted/sensitive/yes/wanted#%s.%s.torrent', '%s/torrents/wanted/sensitive/yes/wanted#%s.torrent',
$this->getParameter('app.torrent.wanted.ftp.folder'), $this->getParameter('app.torrent.wanted.ftp.folder'),
$torrent->getId(), $torrent->getId()
$file->getName()
) )
); );
$torrentService->removeFromFtpStorage( $torrentService->removeFromFtpStorage(
sprintf( sprintf(
'%s/torrents/wanted/sensitive/no/wanted#%s.%s.torrent', '%s/torrents/wanted/sensitive/no/wanted#%s.torrent',
$this->getParameter('app.torrent.wanted.ftp.folder'), $this->getParameter('app.torrent.wanted.ftp.folder'),
$torrent->getId(), $torrent->getId()
$file->getName()
) )
); );
@ -2872,11 +2862,10 @@ class TorrentController extends AbstractController
{ {
$torrentService->removeFromFtpStorage( $torrentService->removeFromFtpStorage(
sprintf( sprintf(
'%s/torrents/wanted/locale/%s/wanted#%s.%s.torrent', '%s/torrents/wanted/locale/%s/wanted#%s.torrent',
$this->getParameter('app.torrent.wanted.ftp.folder'), $this->getParameter('app.torrent.wanted.ftp.folder'),
$locale, $locale,
$torrent->getId(), $torrent->getId()
$file->getName()
) )
); );
} }

Loading…
Cancel
Save