PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` toResponse(request()); } if ($this->valueIsntAFileResponse($returned)) return; $response = $returned; $name = $this->getFilenameFromContentDispositionHeader( $response->headers->get('Content-Disposition') ); $binary = $this->captureOutput(function () use ($response) { $response->sendContent(); }); $content = base64_encode($binary); $this->downloadsById[$component->id] = [ 'name' => $name, 'content' => $content, 'contentType' => $response->headers->get('Content-Type'), ]; }); Livewire::listen('component.dehydrate.subsequent', function ($component, $response) { if (! $download = $this->downloadsById[$component->id] ?? false) return; $response->effects['download'] = $download; }); Livewire::listen('flush-state', function() { $this->downloadsById = []; }); } function valueIsntAFileResponse($value) { return ! $value instanceof StreamedResponse && ! $value instanceof BinaryFileResponse; } function captureOutput($callback) { ob_start(); $callback(); return ob_get_clean(); } function getFilenameFromContentDispositionHeader($header) { /** * The following conditionals are here to allow for quoted and * non quoted filenames in the Content-Disposition header. * * Both of these values should return the correct filename without quotes. * * Content-Disposition: attachment; filename=filename.jpg * Content-Disposition: attachment; filename="test file.jpg" */ if (preg_match('/.*?filename="(.+?)"/', $header, $matches)) { return $matches[1]; } if (preg_match('/.*?filename=([^; ]+)/', $header, $matches)) { return $matches[1]; } return 'download'; } }