Check that the file exists before trying to download

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-11-11 13:50:53 +00:00
parent b6ad69fac2
commit 1fc5bb54e1

View file

@ -37,10 +37,18 @@ class ActionlogController extends Controller
}
}
public function getStoredEula($filename) : Response | BinaryFileResponse
public function getStoredEula($filename) : Response | BinaryFileResponse | RedirectResponse
{
$this->authorize('view', \App\Models\Asset::class);
$file = config('app.private_uploads').'/eula-pdfs/'.$filename;
if (Storage::exists($file)) {
return response()->download($file);
}
return redirect()->back()->with('error', trans('general.file_does_not_exist'));
}
}