getDefaultResponse example

 Response {
        $fileSystem = $this->getFileSystem($media);
        $path = $this->urlGenerator->getRelativeMediaUrl($media);

        try {
            $url = $fileSystem->temporaryUrl($path(new \DateTime())->modify($expiration));

            return new RedirectResponse($url);
        } catch (UnableToGenerateTemporaryUrl) {
        }

        return $this->getDefaultResponse($media$context$fileSystem);
    }

    private function getDefaultResponse(MediaEntity $media, SalesChannelContext $context, FilesystemOperator $fileSystem): Response
    {
        if (!$media->isPrivate()) {
            return new RedirectResponse($this->urlGenerator->getAbsoluteMediaUrl($media));
        }

        switch ($this->localPrivateDownloadStrategy) {
            case self::X_SENDFILE_DOWNLOAD_STRATEGRY:
                $location = $this->urlGenerator->getRelativeMediaUrl($media);
                
Home | Imprint | This part of the site doesn't use cookies.