1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Fixes for S3 storage and delivery notes

This commit is contained in:
David Bomba 2021-05-14 19:43:06 +10:00
parent 0dac08eaa6
commit de8fb374ab
2 changed files with 5 additions and 1 deletions

View File

@ -849,7 +849,6 @@ class InvoiceController extends BaseController
try { try {
$file = public_path("storage/{$file_path}"); $file = public_path("storage/{$file_path}");
return response()->download($file, basename($file), ['Cache-Control:' => 'no-cache']); return response()->download($file, basename($file), ['Cache-Control:' => 'no-cache']);
} catch (\Exception $e) { } catch (\Exception $e) {
return response(['message' => 'Oops, something went wrong. Make sure you have symlink to storage/ in public/ directory.'], 500); return response(['message' => 'Oops, something went wrong. Make sure you have symlink to storage/ in public/ directory.'], 500);

View File

@ -20,6 +20,7 @@ use App\Services\PdfMaker\PdfMaker as PdfMakerService;
use App\Utils\HostedPDF\NinjaPdf; use App\Utils\HostedPDF\NinjaPdf;
use App\Utils\HtmlEngine; use App\Utils\HtmlEngine;
use App\Utils\PhantomJS\Phantom; use App\Utils\PhantomJS\Phantom;
use App\Utils\TempFile;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use App\Utils\Traits\Pdf\PdfMaker; use App\Utils\Traits\Pdf\PdfMaker;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
@ -105,6 +106,10 @@ class GenerateDeliveryNote
Storage::disk($this->disk)->put($file_path, $pdf); Storage::disk($this->disk)->put($file_path, $pdf);
/* Copy from remote disk to local when using cloud file storage. */
if(config('filesystems.default') == 's3')
return TempFile::path(Storage::disk($disk)->url($file_path));
return $file_path; return $file_path;
} }
} }