diff --git a/CHANGELOG.md b/CHANGELOG.md index c15329c62e88..41c457b97688 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Release notes ## [Unreleased (daily channel)](https://github.com/invoiceninja/invoiceninja/tree/v5-develop) +- Add Cache-control: no-cache to prevent overaggressive caching of assets + +## [v5.1.56-release](https://github.com/invoiceninja/invoiceninja/releases/tag/v5.1.56-release) ## Fixed: - Fix User created/updated/deleted Actvity display format - Fix for Stripe autobill / token regression @@ -9,7 +12,7 @@ - Invoice / Quote / Credit created notifications - Logout route - deletes all auth tokens -## [v5.1.54-release](https://github.com/invoiceninja/invoiceninja/releases/tag/v5.1.50-release) +## [v5.1.54-release](https://github.com/invoiceninja/invoiceninja/releases/tag/v5.1.54-release) ## Fixed: - Fixes for e-mails, encoding & parsing invalid HTML diff --git a/app/Http/Controllers/ClientPortal/InvoiceController.php b/app/Http/Controllers/ClientPortal/InvoiceController.php index 8eddfce00646..2300600714c0 100644 --- a/app/Http/Controllers/ClientPortal/InvoiceController.php +++ b/app/Http/Controllers/ClientPortal/InvoiceController.php @@ -164,7 +164,7 @@ class InvoiceController extends Controller if ($invoices->count() == 1) { return response()->streamDownload(function () use ($invoices) { echo file_get_contents($invoices->first()->pdf_file_path()); - }, basename($invoices->first()->pdf_file_path())); + }, basename($invoices->first()->pdf_file_path()), ['Cache-Control:' => 'no-cache']); //return response()->download(TempFile::path($invoices->first()->pdf_file_path()), basename($invoices->first()->pdf_file_path())); } diff --git a/app/Http/Controllers/ClientPortal/QuoteController.php b/app/Http/Controllers/ClientPortal/QuoteController.php index e0c3a1ba99af..e634cdb258e8 100644 --- a/app/Http/Controllers/ClientPortal/QuoteController.php +++ b/app/Http/Controllers/ClientPortal/QuoteController.php @@ -78,7 +78,7 @@ class QuoteController extends Controller if ($quotes->count() == 1) { return response()->streamDownload(function () use ($invoices) { echo file_get_contents($invoices->first()->pdf_file_path()); - }, basename($invoices->first()->pdf_file_path())); + }, basename($invoices->first()->pdf_file_path()), ['Cache-Control:' => 'no-cache']); //return response()->download(TempFile::path($invoices->first()->pdf_file_path()), basename($quotes->first()->pdf_file_path())); } diff --git a/app/Http/Controllers/CreditController.php b/app/Http/Controllers/CreditController.php index 0c48504bf405..e454b80590f2 100644 --- a/app/Http/Controllers/CreditController.php +++ b/app/Http/Controllers/CreditController.php @@ -538,7 +538,7 @@ class CreditController extends BaseController case 'download': return response()->streamDownload(function () use ($credit) { echo file_get_contents($credit->pdf_file_path()); - }, basename($credit->pdf_file_path())); + }, basename($credit->pdf_file_path()), ['Cache-Control:' => 'no-cache']); //return response()->download(TempFile::path($credit->pdf_file_path()), basename($credit->pdf_file_path())); break; case 'archive': @@ -589,7 +589,7 @@ class CreditController extends BaseController $file_path = $credit->service()->getCreditPdf($invitation); - return response()->download($file_path); + return response()->download($file_path, basename($file_path), ['Cache-Control:' => 'no-cache']); } /** diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 306f7745fb4d..bd4fc7a21ba7 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -673,7 +673,7 @@ class InvoiceController extends BaseController case 'download': return response()->streamDownload(function () use ($invoice) { echo file_get_contents($invoice->pdf_file_path()); - }, basename($invoice->pdf_file_path())); + }, basename($invoice->pdf_file_path()), ['Cache-Control:' => 'no-cache']); //return response()->download(TempFile::path($invoice->pdf_file_path()), basename($invoice->pdf_file_path())); break; case 'restore': @@ -795,7 +795,7 @@ class InvoiceController extends BaseController $file_path = $invoice->service()->getInvoicePdf($contact); - return response()->download($file_path, basename($file_path)); + return response()->download($file_path, basename($file_path), ['Cache-Control:' => 'no-cache']); } /** @@ -850,7 +850,7 @@ class InvoiceController extends BaseController $file = public_path("storage/{$file_path}"); - return response()->download($file, basename($file)); + return response()->download($file, basename($file), ['Cache-Control:' => 'no-cache']); } catch (\Exception $e) { return response(['message' => 'Oops, something went wrong. Make sure you have symlink to storage/ in public/ directory.'], 500); } diff --git a/app/Http/Controllers/PreviewController.php b/app/Http/Controllers/PreviewController.php index 6f74313cb885..70c21a9554f2 100644 --- a/app/Http/Controllers/PreviewController.php +++ b/app/Http/Controllers/PreviewController.php @@ -142,7 +142,7 @@ class PreviewController extends BaseController //else $file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company()); - return response()->download($file_path)->deleteFileAfterSend(true); + return response()->download($file_path, basename($file_path), ['Cache-Control:' => 'no-cache'])->deleteFileAfterSend(true); } return $this->blankEntity(); diff --git a/app/Http/Controllers/QuoteController.php b/app/Http/Controllers/QuoteController.php index b570c8ede058..eba6624638c3 100644 --- a/app/Http/Controllers/QuoteController.php +++ b/app/Http/Controllers/QuoteController.php @@ -677,7 +677,7 @@ class QuoteController extends BaseController case 'download': return response()->streamDownload(function () use ($quote) { echo file_get_contents($quote->pdf_file_path()); - }, basename($quote->pdf_file_path())); + }, basename($quote->pdf_file_path()), ['Cache-Control:' => 'no-cache']); //return response()->download(TempFile::path($quote->pdf_file_path()), basename($quote->pdf_file_path())); break; case 'restore': @@ -730,7 +730,7 @@ class QuoteController extends BaseController $file_path = $quote->service()->getQuotePdf($contact); - return response()->download($file_path); + return response()->download($file_path, basename($file_path), ['Cache-Control:' => 'no-cache']); } /** diff --git a/app/Http/Controllers/RecurringInvoiceController.php b/app/Http/Controllers/RecurringInvoiceController.php index 5acf54ac66f6..e5a94e25ac59 100644 --- a/app/Http/Controllers/RecurringInvoiceController.php +++ b/app/Http/Controllers/RecurringInvoiceController.php @@ -490,7 +490,7 @@ class RecurringInvoiceController extends BaseController $file_path = $recurring_invoice->service()->getInvoicePdf($contact); - return response()->download($file_path, basename($file_path)); + return response()->download($file_path, basename($file_path), ['Cache-Control:' => 'no-cache']); } /**