diff --git a/library/ajax/view_torrent.php b/library/ajax/view_torrent.php index 88367beb..eb6d9c27 100644 --- a/library/ajax/view_torrent.php +++ b/library/ajax/view_torrent.php @@ -17,18 +17,15 @@ $torrent = DB()->fetch_row("SELECT at.attach_id, at.physical_filename FROM ". BB if (!$torrent) $this->ajax_die($lang['EMPTY_ATTACH_ID']); $filename = get_attachments_dir() .'/'. $torrent['physical_filename']; -if (($file_contents = @file_get_contents($filename)) === false) +if (!@file_exists($filename) || (false === ($file_contents = @file_get_contents($filename)))) { - if (!file_exists($filename)) + if (IS_AM) { - if (IS_AM) - { - $this->ajax_die($lang['ERROR_NO_ATTACHMENT'] ."\n\n". htmlCHR($filename)); - } - else - { - $this->ajax_die($lang['ERROR_NO_ATTACHMENT']); - } + $this->ajax_die($lang['ERROR_NO_ATTACHMENT'] ."\n\n". htmlCHR($filename)); + } + else + { + $this->ajax_die($lang['ERROR_NO_ATTACHMENT']); } }