diff --git a/app/Http/Controllers/ClientPortalController.php b/app/Http/Controllers/ClientPortalController.php index ee9f284943..7b25e02918 100644 --- a/app/Http/Controllers/ClientPortalController.php +++ b/app/Http/Controllers/ClientPortalController.php @@ -584,6 +584,10 @@ class ClientPortalController extends BaseController private function returnError($error = false) { + if (request()->phantomjs) { + abort(404); + } + return response()->view('error', [ 'error' => $error ?: trans('texts.invoice_not_found'), 'hideHeader' => true, diff --git a/app/Http/Controllers/InvoiceApiController.php b/app/Http/Controllers/InvoiceApiController.php index 7eeb44e1eb..a6f700ef0f 100644 --- a/app/Http/Controllers/InvoiceApiController.php +++ b/app/Http/Controllers/InvoiceApiController.php @@ -423,7 +423,12 @@ class InvoiceApiController extends BaseAPIController public function download(InvoiceRequest $request) { $invoice = $request->entity(); + $pdfString = $invoice->getPDFString(); - return $this->fileReponse($invoice->getFileName(), $invoice->getPDFString()); + if ($pdfString) { + return $this->fileReponse($invoice->getFileName(), $pdfString); + } else { + abort(404); + } } }