[Cover] Added cover route verifications

This commit is contained in:
Daniel 2020-11-29 18:15:01 +00:00 committed by Hugo Sales
parent 4eafcd5058
commit b79c8b092d
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 8 additions and 1 deletions

View File

@ -34,6 +34,7 @@ use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Validator\Constraints\File as F;
/**
@ -125,7 +126,13 @@ class Cover
public function cover()
{
$cover = DB::find('cover', ['gsactor_id' => Common::user()->getId()]);
$file = $cover->getFile();
if ($cover == null) {
return new Response('Cover not found',Response::HTTP_NOT_FOUND);
}
$file = $cover->getFile();
if ($file == null) {
return new Response('Cover File not found',Response::HTTP_NOT_FOUND);
}
return M::sendFile($cover->getFilePath(), $file->getMimetype(), $file->getTitle());
}
}