diff --git a/app/Http/Controllers/DocumentAPIController.php b/app/Http/Controllers/DocumentAPIController.php index 01a05a17e2..5ceb477a5c 100644 --- a/app/Http/Controllers/DocumentAPIController.php +++ b/app/Http/Controllers/DocumentAPIController.php @@ -52,8 +52,10 @@ class DocumentAPIController extends BaseAPIController { $document = $request->entity(); - return DocumentController::getDownloadResponse($document); - } + if(array_key_exists($document->type, Document::$types)) + return DocumentController::getDownloadResponse($document); + else + return $this->errorResponse(['error'=>'Invalid mime type'],400); } /** * @param CreateDocumentRequest $request