// only printable ascii
(string) preg_replace('/[\x00-\x1F\x7F-\xFF]/', '',
$originalName) ),
'Content-Length' =>
$this->filesystem->
fileSize($entity->
getPath()),
'Content-Type' => 'application/octet-stream',
];
$stream =
$this->filesystem->
readStream($entity->
getPath());
if (!\
is_resource($stream)) { throw ImportExportException::
fileNotFound($fileId);
} return new StreamedResponse(function D
) use ($stream): void
{ fpassthru($stream);
}, Response::HTTP_OK,
$headers);
} private function findFile(Context
$context, string
$fileId): ImportExportFileEntity
{ $entity =
$this->fileRepository->
search(new Criteria([$fileId]),
$context)->
get($fileId);
if (!
$entity instanceof ImportExportFileEntity
) { throw ImportExportException::
fileNotFound($fileId);
}