Skip to content

Commit

Permalink
Fixes #16000 - add S3 support for eula PDF downloads
Browse files Browse the repository at this point in the history
Signed-off-by: snipe <snipe@snipe.net>
  • Loading branch information
snipe committed Jan 17, 2025
1 parent 7e65d68 commit 434068a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/Http/Controllers/ActionlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ public function displaySig($filename) : RedirectResponse | Response | bool
public function getStoredEula($filename) : Response | BinaryFileResponse | RedirectResponse
{
$this->authorize('view', \App\Models\Asset::class);
$file = config('app.private_uploads').'/eula-pdfs/'.$filename;

if (config('filesystems.default') == 's3_private') {
return redirect()->away(Storage::disk('s3_private')->temporaryUrl('private_uploads/eula-pdfs/'.$filename, now()->addMinutes(5)));
}

if (Storage::exists('private_uploads/eula-pdfs/'.$filename)) {
return response()->download($file);
return response()->download(config('app.private_uploads').'/eula-pdfs/'.$filename);
}

return redirect()->back()->with('error', trans('general.file_does_not_exist'));
Expand Down

0 comments on commit 434068a

Please sign in to comment.