$meta =
$filesystem->
getMetadata($location);
$mimeType =
$filesystem->
getMimetype($location) ?: 'application/octet-stream';
$response =
$this->front->
Response();
if ($this->
canServedLocal($filesystem,
$downloadStrategy)) { $publicUrl =
$this->publicUrlGenerator->
generateUrl($location);
$path =
(string) parse_url($publicUrl, PHP_URL_PATH
);
switch ($downloadStrategy) { case 0:
$response->
setRedirect($publicUrl);
break;
case 2:
$location =
$this->privateFilesystemRoot . '/' .
$location;
$response->headers->
set('content-type', 'application/octet-stream'
);
$response->headers->
set('content-disposition',
sprintf('attachment; filename="%s"',
basename($location)));
$response->headers->
set('x-sendfile',
$location);
break;
case 3:
$response->headers->
set('content-type', 'application/octet-stream'
);
$response->headers->
set('content-disposition',
sprintf('attachment; filename="%s"',
basename($location)));
$response->headers->
set('x-accel-redirect',
$path);