1
0
Fork 0
forked from mirror/pixelfed

Update upload endpoints with MediaBlocklist checks

This commit is contained in:
Daniel Supernault 2020-07-26 22:17:00 -06:00
parent 5d0a24a779
commit 597378bfb4
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 8 additions and 1 deletions

View file

@ -48,9 +48,11 @@ use App\Jobs\VideoPipeline\{
use App\Services\{
NotificationService,
MediaPathService,
SearchApiV2Service
SearchApiV2Service,
MediaBlocklistService
};
class ApiV1Controller extends Controller
{
protected $fractal;
@ -1046,6 +1048,8 @@ class ApiV1Controller extends Controller
$path = $photo->store($storagePath);
$hash = \hash_file('sha256', $photo);
abort_if(MediaBlocklistService::exists($hash) == true, 451);
$media = new Media();
$media->status_id = null;
$media->profile_id = $profile->id;

View file

@ -36,6 +36,7 @@ use App\Jobs\VideoPipeline\{
};
use App\Services\NotificationService;
use App\Services\MediaPathService;
use App\Services\MediaBlocklistService;
class BaseApiController extends Controller
{
@ -247,6 +248,8 @@ class BaseApiController extends Controller
$path = $photo->store($storagePath);
$hash = \hash_file('sha256', $photo);
abort_if(MediaBlocklistService::exists($hash) == true, 451);
$media = new Media();
$media->status_id = null;
$media->profile_id = $profile->id;