Skip to content

Commit 1fc5bb5

Browse files
committed
Check that the file exists before trying to download
Signed-off-by: snipe <[email protected]>
1 parent b6ad69f commit 1fc5bb5

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)