Fixes for proteted downloads

This commit is contained in:
David Bomba 2023-07-17 12:01:35 +10:00
parent 18ca64c72c
commit 40a16226eb
2 changed files with 5 additions and 3 deletions

View File

@ -29,8 +29,10 @@ class ProtectedDownloadController extends BaseController
throw new SystemError('File no longer available', 404);
abort(404, 'File no longer available');
}
return response()->download($hashed_path, basename($hashed_path), [])->deleteFileAfterSend(true);
return response()->streamDownload(function () use ($hashed_path) {
echo Storage::get($hashed_path);
}, basename($hashed_path), []);
}

View File

@ -406,6 +406,6 @@ Route::post('api/v1/yodlee/data_updates', [YodleeController::class, 'dataUpdates
Route::post('api/v1/yodlee/refresh_updates', [YodleeController::class, 'refreshUpdatesWebhook'])->middleware('throttle:100,1');
Route::post('api/v1/yodlee/balance', [YodleeController::class, 'balanceWebhook'])->middleware('throttle:100,1');
Route::get('api/v1/protected_download/{hash}', [ProtectedDownloadController::class, 'index'])->name('protected_download')->middleware('signed')->middleware('throttle:300,1');
Route::get('api/v1/protected_download/{hash}', [ProtectedDownloadController::class, 'index'])->name('protected_download')->middleware('throttle:300,1');
Route::fallback([BaseController::class, 'notFound'])->middleware('throttle:404');