当我们尝试下载荣耀文件" /download_file/view/myFile.test"时,有没有办法抛出404而不是200?具体5.我使用的是版本8.2.1
感谢您的帮助
答案 0 :(得分:0)
解决方案是覆盖DownloadFile控制器和视图方法:
namespace Application\Controller\SinglePage;
use PageController;
use Core;
use Page;
use Permissions;
use Concrete\Core\Entity\File\File as FileEntity;
use Concrete\Core\File\File;
use Concrete\Controller\SinglePage\DownloadFile as CoreDownloadFile;
class DownloadFile extends CoreDownloadFile
{
/**
* @param int $fID
* @param null $rcID
* @return bool
*/
public function view($fID = 0, $rcID = null)
{
//your code
//redirect to 404 whenever you want:
$this->replace('/page_not_found');
//...
}
}