Skip to content

Commit

Permalink
Add filename fallback for download
Browse files Browse the repository at this point in the history
  • Loading branch information
MLDMoritz authored Jul 27, 2023
1 parent bd7cd4b commit 19be7f1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/VueFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,15 @@ public function download()
$path = $this->request->get('path');
$response = $this->streamFile($path);

$filenameFallback = preg_replace(
'#^.*\.#',
md5($path) . '.', $path
);

$disposition = $response->headers->makeDisposition(
ResponseHeaderBag::DISPOSITION_ATTACHMENT,
basename($path)
basename($path),
$filenameFallback
);
$response->headers->set('Content-Disposition', $disposition);

Expand Down

0 comments on commit 19be7f1

Please sign in to comment.