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

fixes no response being send on download #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KreutzerCode
Copy link

After updating to version 1.3.1, no file download response was triggered when calling the download function, which may result in empty pdf files #31.

This is due to the new use of the "Illuminate\Http\Response" class inside of the download method.

        $output = $this->output();
        return new Response($output, 200, [
            'Content-Type' => 'application/pdf',
            'Content-Disposition' =>  'attachment; filename="' . $this->fileName . '"',
            'Content-Length' => strlen($output),
        ]);

The reason for the problem is that the response is generated and returned but not sent. To do this, we have to call the send method of the response class.

        $output = $this->output();
        $response = new Response($output, 200, [
            'Content-Type' => 'application/pdf',
            'Content-Disposition' =>  'attachment; filename="' . $this->fileName . '"',
            'Content-Length' => strlen($output),
        ]);
        return $response->send();

This solves the problem!
(tested on laravel 9)

@KreutzerCode KreutzerCode changed the title [BUGFIX] fixes no response being send on download #31 fixes no response being send on download Oct 31, 2022
@wblondel
Copy link

wblondel commented Jan 9, 2023

Hi @Webklex , can we merge this?

@ankheur
Copy link

ankheur commented Mar 24, 2023

I got the problem this commit fixes ! Empty blank page when I tried to use the download() method.
Thanks a lot for this fix, hope it gets merged soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants