You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you render a view in a request for building a file such as a pdf but return the pdf file you will trigger the following exception:
Call to undefined method Symfony\\Component\\HttpFoundation\\BinaryFileResponse::header() at /project/vendor/laravel/framework/src/Illuminate/Http/Middleware/AddLinkHeadersForPreloadedAssets.php:21)
The issue is that @Vite compiles a list of urls to preload and the middleware will try to attach them to the response. It seems like the middleware should check what type of response it has before attempting to apply the header. I believe any of the ResponseFactory methods that return Symfony classes instead of Illuminate classes will also have this problem.
Steps To Reproduce
Use either jetstream/breeze to setup a new project (confirm for the inertia stacks)
Add a route to the web routes that renders a view containing @vite but returns a BinaryFileResponse return response()->file(); or return response()->file();
Run npm run build (npm run hot does not compile the list of preloaded urls)
Try to download the file
The text was updated successfully, but these errors were encountered:
Laravel Version
11.22.0
PHP Version
8.2.23
Database Driver & Version
No response
Description
If you render a view in a request for building a file such as a pdf but return the pdf file you will trigger the following exception:
The issue is that @Vite compiles a list of urls to preload and the middleware will try to attach them to the response. It seems like the middleware should check what type of response it has before attempting to apply the header. I believe any of the ResponseFactory methods that return Symfony classes instead of Illuminate classes will also have this problem.
Steps To Reproduce
@vite
but returns a BinaryFileResponsereturn response()->file();
orreturn response()->file();
npm run build
(npm run hot
does not compile the list of preloaded urls)The text was updated successfully, but these errors were encountered: