1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-05 18:52:44 +01:00

wrap getting file into try-catch

This commit is contained in:
Benjamin Beganović 2020-12-08 13:10:27 +01:00
parent 4f2bf09c0c
commit 812824100c

View File

@ -843,8 +843,12 @@ class InvoiceController extends BaseController
{
$file_path = $invoice->service()->getInvoiceDeliveryNote($invoice, $invoice->invitations->first()->contact);
$file = base_path("storage/app/public/{$file_path}");
try {
$file = base_path("public/storage/{$file_path}");
return response()->download($file, basename($file));
return response()->download($file, basename($file));
} catch(\Exception $e) {
return response(['message' => 'Oops, something went wrong. Make sure you have symlink to storage/ in public/ directory.'], 500);
}
}
}