Merge pull request #15794 from snipe/check_for_file_on_asset_acceptance
Some checks failed
Crowdin Action / upload-sources-to-crowdin (push) Has been cancelled
Docker images (Alpine) / docker (push) Has been cancelled
Docker images / docker (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.1) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.2) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.3) (push) Has been cancelled
Tests in SQLite / PHP ${{ matrix.php-version }} (8.1.1) (push) Has been cancelled

Check that the file exists before trying to download stored EULA
This commit is contained in:
snipe 2024-11-11 13:54:09 +00:00 committed by GitHub
commit 6bec573956
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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); $this->authorize('view', \App\Models\Asset::class);
$file = config('app.private_uploads').'/eula-pdfs/'.$filename; $file = config('app.private_uploads').'/eula-pdfs/'.$filename;
return response()->download($file);
if (Storage::exists($file)) {
return response()->download($file);
}
return redirect()->back()->with('error', trans('general.file_does_not_exist'));
} }
} }