|
6 | 6 | */
|
7 | 7 | namespace Magento\Theme\Controller\Adminhtml\System\Design\Theme;
|
8 | 8 |
|
| 9 | +use Magento\Backend\App\Action\Context; |
9 | 10 | use Magento\Framework\App\Action\HttpGetActionInterface;
|
| 11 | +use Magento\Framework\App\Response\Http\FileFactory; |
10 | 12 | use Magento\Framework\App\ResponseInterface;
|
11 | 13 | use Magento\Framework\App\Filesystem\DirectoryList;
|
12 |
| -use Magento\Theme\Controller\Adminhtml\System\Design\Theme; |
| 14 | +use Magento\Framework\Escaper; |
| 15 | +use Magento\Framework\Filesystem; |
| 16 | +use Magento\Framework\Registry; |
13 | 17 | use Magento\Framework\Url\DecoderInterface;
|
| 18 | +use Magento\Framework\View\Asset\Repository; |
14 | 19 | use Magento\Framework\View\Design\ThemeInterface;
|
| 20 | +use Magento\Theme\Controller\Adminhtml\System\Design\Theme; |
15 | 21 | use Psr\Log\LoggerInterface;
|
16 | 22 |
|
17 | 23 | /**
|
|
22 | 28 | */
|
23 | 29 | class DownloadCss extends Theme implements HttpGetActionInterface
|
24 | 30 | {
|
| 31 | + /** |
| 32 | + * @var Escaper |
| 33 | + */ |
| 34 | + private $escaper; |
| 35 | + |
| 36 | + /** |
| 37 | + * DownloadCss constructor. |
| 38 | + * @param Context $context |
| 39 | + * @param Registry $coreRegistry |
| 40 | + * @param FileFactory $fileFactory |
| 41 | + * @param Repository $assetRepo |
| 42 | + * @param Filesystem $appFileSystem |
| 43 | + * @param Escaper|null $escaper |
| 44 | + */ |
| 45 | + public function __construct( |
| 46 | + Context $context, |
| 47 | + Registry $coreRegistry, |
| 48 | + FileFactory $fileFactory, |
| 49 | + Repository $assetRepo, |
| 50 | + Filesystem $appFileSystem, |
| 51 | + Escaper $escaper = null |
| 52 | + ) { |
| 53 | + $this->escaper = $escaper ?? $context->getObjectManager()->get(Escaper::class); |
| 54 | + parent::__construct($context, $coreRegistry, $fileFactory, $assetRepo, $appFileSystem); |
| 55 | + } |
| 56 | + |
25 | 57 | /**
|
26 | 58 | * Download css file
|
27 | 59 | *
|
@@ -54,11 +86,11 @@ public function execute()
|
54 | 86 | DirectoryList::ROOT
|
55 | 87 | );
|
56 | 88 | } catch (\InvalidArgumentException $e) {
|
57 |
| - $this->messageManager->addException($e, sprintf('Theme not found: "%d".', $themeId)); |
| 89 | + $this->messageManager->addException($e, __('Theme not found: "%1".', $this->escaper->escapeHtml($themeId))); |
58 | 90 | $this->getResponse()->setRedirect($this->_redirect->getRefererUrl());
|
59 | 91 | $this->_objectManager->get(LoggerInterface::class)->critical($e);
|
60 | 92 | } catch (\Exception $e) {
|
61 |
| - $this->messageManager->addException($e, sprintf('File not found: "%d".', $fileId)); |
| 93 | + $this->messageManager->addException($e, __('File not found: "%1".', $this->escaper->escapeHtml($fileId))); |
62 | 94 | $this->getResponse()->setRedirect($this->_redirect->getRefererUrl());
|
63 | 95 | $this->_objectManager->get(LoggerInterface::class)->critical($e);
|
64 | 96 | }
|
|
0 commit comments