Skip to content

Commit d2f6d41

Browse files
committed
fix: download response
1 parent 279a27b commit d2f6d41

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Controller/MediaController.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,16 @@ public function downloadAction($id, Request $request, string $format = 'referenc
6464
}
6565
$provider = $this->getProvider($media);
6666

67+
$filename = $media->getMetadataValue('filename');
68+
$headers = [
69+
'x-filename' => $filename,
70+
];
71+
if ($request->query->get('inline')) {
72+
$headers['Content-Disposition'] = sprintf('inline; filename="%s"', $filename);
73+
}
74+
6775
try {
68-
$response = $provider->getDownloadResponse($media, $provider->getFormatName($media, $format), $this->pool->getDownloadMode($media));
76+
$response = $provider->getDownloadResponse($media, $provider->getFormatName($media, $format), $this->pool->getDownloadMode($media), $headers);
6977
} catch (FileNotFound) {
7078
throw $this->createNotFoundException();
7179
}

0 commit comments

Comments
 (0)