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

Closed
federicosilvestri opened this issue Dec 24, 2024 · 5 comments
Closed

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

federicosilvestri opened this issue Dec 24, 2024 · 5 comments
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
Copy link
Owner

snipe commented Jan 17, 2025

Can you take a look at this PR and see if it works for you? #16090

@federicosilvestri
Copy link
Author

I have tested it in my environment and it works. Thank you.

@snipe
Copy link
Owner

snipe commented Jan 18, 2025

Great, thanks for confirming. I still need to do a few more tests with local file storage, but once that's complete, it should be in the next release.

@federicosilvestri
Copy link
Author

federicosilvestri commented Jan 18, 2025 via email

snipe added a commit that referenced this issue Jan 20, 2025
Fixed #16000 - add S3 support for eula PDF downloads
@snipe snipe closed this as completed in 434068a Jan 20, 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