Downloading files not working
thecyrilcril opened this issue · 1 comments
thecyrilcril commented
- Laravel Version: 10.23.1
- PHP Version: 8.1.13
- Splade JS Version (npm): 1.4.16
- Splade PHP Version (composer): 1.4.16
- Dev environment (OS, Sail/Valet/etc): Windows 10 Pro. /WAMP
php artisan splade:show-versions
Description:
Attempting to download via the controller using the getMedia('collection_name')->last()
and getFirstMedia('collection_name')
methods throw Call to undefined method Symfony\Component\HttpFoundation\StreamedResponse::content()
Steps To Reproduce Issue:
<Link href="/items/29/download-proof-of-purchase" method="POST">Download</Link>
<x-splade-form blob action="/items/29/download-proof-of-purchase">
<button type="submit">Download</button>
</x-splade-form>
public function __invoke(Request $request, Item $item)
{
return $item
->getMedia('collection_name')->last();
}
thecyrilcril commented
Turns off the error was triggered by one of my the packages in my project
in [C:\wamp64\www\bot-express\vendor\laragear\poke\src\Http\Middleware\InjectScript.php ](http://botexpress.test/items/29/download-proof-of-purchase)(line 77)
* @param \Illuminate\Http\Response $response * @return bool */ protected function hasCsrfInput(Response $response): bool { return strpos($response->content(), csrf_field()); } /** * Sets the Script in the body. *