src/PHPDish/Component/Media/Manager/FileDownloader.php
public function download($mediaUrl)
    {
        try {
            $response = $this->httpClient->get($mediaUrl);
        } catch(\Exception $exception) {
            throw new \RuntimeException(sprintf('Fail to donwload the resource "%s"', $mediaUrl));
        }
        //查找扩展名
        $extension = $this->resolveExtension($mediaUrl, $response);

        $file = $this->fileFactory->createFileWithExtension($extension);
        $file->setContent($response->getBody());
        $this->fileManager->upload($file);

        return $file;
    }
public function download($mediaUrl)
    {
        try {
            $response = $this->httpClient->get($mediaUrl);
        } catch(\Exception $exception) {
            throw new \RuntimeException(sprintf('Fail to donwload the resource "%s"', $mediaUrl));
        }
        //查找扩展名
        $extension = $this->resolveExtension($mediaUrl, $response);

        $file = $this->fileFactory->createFileWithExtension($extension);
        $file->setContent($response->getBody());
        $this->fileManager->upload($file);

        return $file;
    }
{@inheritdoc}