From 9847934de9adbfef32811558edabe98db2020db8 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 19 Feb 2024 12:20:37 +0000 Subject: [PATCH] Better handle large downloads on backup API Signed-off-by: snipe --- app/Http/Controllers/Api/SettingsController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/SettingsController.php b/app/Http/Controllers/Api/SettingsController.php index a0438ef078..4cd8b8deb9 100644 --- a/app/Http/Controllers/Api/SettingsController.php +++ b/app/Http/Controllers/Api/SettingsController.php @@ -249,6 +249,7 @@ class SettingsController extends Controller 'filesize' => Setting::fileSizeConvert(Storage::size($backup_files[$f])), 'modified_value' => $file_timestamp, 'modified_display' => date($settings->date_display_format.' '.$settings->time_display_format, $file_timestamp), + 'backup_url' => config('app.url').'/settings/backups/download/'.basename($backup_files[$f]), ]; $count++; @@ -269,7 +270,7 @@ class SettingsController extends Controller $path = 'app/backups'; if (Storage::exists($path.'/'.$file)) { $headers = ['ContentType' => 'application/zip']; - return Storage::download($path.'/'.$file, $file, $headers); + return response()->download($path.'/'.$file, $file, $headers); } else { return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.file_not_found'))); }