forked from GNUsocial/gnu-social
[Cover] Added cover route verifications
This commit is contained in:
parent
4eafcd5058
commit
b79c8b092d
@ -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\HiddenType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Validator\Constraints\File as F;
|
use Symfony\Component\Validator\Constraints\File as F;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,7 +126,13 @@ class Cover
|
|||||||
public function cover()
|
public function cover()
|
||||||
{
|
{
|
||||||
$cover = DB::find('cover', ['gsactor_id' => Common::user()->getId()]);
|
$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());
|
return M::sendFile($cover->getFilePath(), $file->getMimetype(), $file->getTitle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user