Skip to content

Commit 6bec573

Browse files
authored
Merge pull request #15794 from snipe/check_for_file_on_asset_acceptance
Check that the file exists before trying to download stored EULA
2 parents b6ad69f + 1fc5bb5 commit 6bec573

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

app/Http/Controllers/ActionlogController.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,18 @@ public function displaySig($filename) : RedirectResponse | Response | bool
3737
}
3838
}
3939

40-
public function getStoredEula($filename) : Response | BinaryFileResponse
40+
public function getStoredEula($filename) : Response | BinaryFileResponse | RedirectResponse
4141
{
4242
$this->authorize('view', \App\Models\Asset::class);
4343
$file = config('app.private_uploads').'/eula-pdfs/'.$filename;
44-
return response()->download($file);
44+
45+
if (Storage::exists($file)) {
46+
return response()->download($file);
47+
}
48+
49+
return redirect()->back()->with('error', trans('general.file_does_not_exist'));
50+
51+
52+
4553
}
4654
}

0 commit comments

Comments
 (0)