19declare(strict_types=1);
48 $this->delivery =
$DIC->fileDelivery()->delivery();
54 public function run(): void
56 $revision = $this->getRevision();
57 $filename_with_extension = $this->file_name ?? $revision->getInformation()->getTitle();
58 $extension = pathinfo($filename_with_extension, PATHINFO_EXTENSION);
59 $file_name_for_consumer = $this->file_name_policy->prepareFileNameForConsumer($filename_with_extension);
61 $mime_type = $this->file_name_policy->isValidExtension($extension)
62 ? $revision->getInformation()->getMimeType()
66 $revision = $this->stream_access->populateRevision($revision);
69 'attachment' => $this->delivery->attached(
70 $revision->maybeStreamResolver()?->getStream(),
71 $file_name_for_consumer,
74 'inline' => $this->delivery->inline(
75 $revision->maybeStreamResolver()?->getStream(),
76 $file_name_for_consumer,
79 default =>
throw new \InvalidArgumentException(
'Invalid disposition'),
const APPLICATION__OCTET_STREAM
const NON_VALID_EXTENSION_MIME
run()
This runs the actual DeliveryConsumer.
__construct(Services $http, StorableResource $resource, StreamAccess $stream_access, FileNamePolicy $file_name_policy)
Interface DeliveryConsumer.
Interface FileNamePolicy.
Interface StorageResource.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...