Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: EULA PDFs are not downloadable with S3 support #16000

Open
federicosilvestri opened this issue Dec 24, 2024 · 1 comment
Open

BUG: EULA PDFs are not downloadable with S3 support #16000

federicosilvestri opened this issue Dec 24, 2024 · 1 comment
Labels
✋ bug Confirmed bug

Comments

@federicosilvestri
Copy link

The function getStoredEula does not use S3 to generate a valid URL for the EULA PDFs.

public function getStoredEula($filename) : Response | BinaryFileResponse | RedirectResponse

I suggest to implement the function like this:

public function getStoredEula($filename) : Response | BinaryFileResponse | RedirectResponse
    {
        $this->authorize('view', \App\Models\Asset::class);
        $disk = config('filesystems.default');
        
        switch (config("filesystems.disks.$disk.driver")) {
            case 's3':
                $file = 'private_uploads/eula-pdfs/'.$filename;
                return redirect()->away(Storage::disk($disk)->temporaryUrl($file, now()->addMinutes(5)));
            default:
                $file = config('app.private_uploads').'/eula-pdfs/'.$filename;
                if (Storage::exists('private_uploads/eula-pdfs/'.$filename)) {
                    return response()->download($file);
                }
                return redirect()->back()->with('error',  trans('general.file_does_not_exist'));
        }

    }
Copy link

welcome bot commented Dec 24, 2024

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@snipe snipe added the ✋ bug Confirmed bug label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✋ bug Confirmed bug
Projects
None yet
Development

No branches or pull requests

2 participants