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(
60
60
*/
61
61
public function execute ()
62
62
{
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
+
63
71
try {
64
- if (!$ this ->getRequest ()->isPost ()) {
65
- //phpcs:ignore Magento2.Exceptions.DirectThrow
66
- throw new \Exception ('Wrong request. ' );
67
- }
68
72
$ files = $ this ->getRequest ()->getParam ('files ' );
69
73
70
74
/** @var $helper \Magento\Cms\Helper\Wysiwyg\Images */
@@ -90,8 +94,6 @@ public function execute()
90
94
// phpcs:ignore Magento2.Exceptions.ThrowCatch
91
95
} catch (\Exception $ e ) {
92
96
$ result = ['error ' => true , 'message ' => $ e ->getMessage ()];
93
- /** @var \Magento\Framework\Controller\Result\Json $resultJson */
94
- $ resultJson = $ this ->resultJsonFactory ->create ();
95
97
96
98
return $ resultJson ->setData ($ result );
97
99
}
Original file line number Diff line number Diff line change @@ -105,6 +105,10 @@ public function testExecute(string $filename)
105
105
public function executeDataProvider (): array
106
106
{
107
107
return [
108
+ ['name with spaces.jpg ' ],
109
+ ['name with, comma.jpg ' ],
110
+ ['name with* asterisk.jpg ' ],
111
+ ['name with[ bracket.jpg ' ],
108
112
['magento_small_image.jpg ' ],
109
113
['_.jpg ' ],
110
114
[' - .jpg ' ],
You can’t perform that action at this time.
0 commit comments