File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images
dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -60,11 +60,15 @@ public function __construct(
6060 */
6161 public function execute ()
6262 {
63+ $ resultJson = $ this ->resultJsonFactory ->create ();
64+
65+ if (!$ this ->getRequest ()->isPost ()) {
66+ $ result = ['error ' => true , 'message ' => __ ('Wrong request. ' )];
67+ /** @var \Magento\Framework\Controller\Result\Json $resultJson */
68+ return $ resultJson ->setData ($ result );
69+ }
70+
6371 try {
64- if (!$ this ->getRequest ()->isPost ()) {
65- //phpcs:ignore Magento2.Exceptions.DirectThrow
66- throw new \Exception ('Wrong request. ' );
67- }
6872 $ files = $ this ->getRequest ()->getParam ('files ' );
6973
7074 /** @var $helper \Magento\Cms\Helper\Wysiwyg\Images */
@@ -90,8 +94,6 @@ public function execute()
9094 // phpcs:ignore Magento2.Exceptions.ThrowCatch
9195 } catch (\Exception $ e ) {
9296 $ result = ['error ' => true , 'message ' => $ e ->getMessage ()];
93- /** @var \Magento\Framework\Controller\Result\Json $resultJson */
94- $ resultJson = $ this ->resultJsonFactory ->create ();
9597
9698 return $ resultJson ->setData ($ result );
9799 }
Original file line number Diff line number Diff line change @@ -105,6 +105,10 @@ public function testExecute(string $filename)
105105 public function executeDataProvider (): array
106106 {
107107 return [
108+ ['name with spaces.jpg ' ],
109+ ['name with, comma.jpg ' ],
110+ ['name with* asterisk.jpg ' ],
111+ ['name with[ bracket.jpg ' ],
108112 ['magento_small_image.jpg ' ],
109113 ['_.jpg ' ],
110114 [' - .jpg ' ],
You can’t perform that action at this time.
0 commit comments