1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 14:49:59 +00:00

torrents: don't allow download of deleted torrents (#399)

Only allow moderators to download torrent files that are deleted.
This commit is contained in:
Nicolas F 2017-11-03 17:54:08 +01:00 committed by Anna-Maria Meriniemi
parent 7095567b29
commit 96468a5a11

View file

@ -316,6 +316,9 @@ def download_torrent(torrent_id):
if not torrent or not torrent.has_torrent: if not torrent or not torrent.has_torrent:
flask.abort(404) flask.abort(404)
if torrent.deleted and not (flask.g.user and flask.g.user.is_moderator):
flask.abort(404)
torrent_file, torrent_file_size = _get_cached_torrent_file(torrent) torrent_file, torrent_file_size = _get_cached_torrent_file(torrent)
disposition = 'inline; filename="{0}"; filename*=UTF-8\'\'{0}'.format( disposition = 'inline; filename="{0}"; filename*=UTF-8\'\'{0}'.format(
quote(torrent.torrent_name.encode('utf-8'))) quote(torrent.torrent_name.encode('utf-8')))