File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed
app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery
dev/tests/integration/testsuite/Magento/Catalog
Controller/Adminhtml/Product/Gallery Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -108,8 +108,10 @@ public function execute()
108108
109109 $ result ['url ' ] = $ this ->productMediaConfig ->getTmpMediaUrl ($ result ['file ' ]);
110110 $ result ['file ' ] = $ result ['file ' ] . '.tmp ' ;
111- } catch (\ Exception $ e ) {
111+ } catch (LocalizedException $ e ) {
112112 $ result = ['error ' => $ e ->getMessage (), 'errorcode ' => $ e ->getCode ()];
113+ } catch (\Throwable $ e ) {
114+ $ result = ['error ' => 'Something went wrong while saving the file(s). ' , 'errorcode ' => 0 ];
113115 }
114116
115117 /** @var \Magento\Framework\Controller\Result\Raw $response */
Original file line number Diff line number Diff line change @@ -198,18 +198,31 @@ public function uploadActionWithErrorsDataProvider(): array
198198 'current_path ' => '/../../../../_files ' ,
199199 ],
200200 'expectation ' => [
201- 'message ' => 'Wrong file size . ' ,
201+ 'message ' => 'Something went wrong while saving the file(s) . ' ,
202202 'errorcode ' => 0 ,
203203 'tmp_media_path ' => '/m/a/magento_empty.jpg ' ,
204204 ],
205205 ],
206206 'upload_without_image ' => [
207207 'file ' => [],
208208 'expectation ' => [
209- 'message ' => '$_FILES array is empty ' ,
209+ 'message ' => 'Something went wrong while saving the file(s). ' ,
210210 'errorcode ' => 0 ,
211211 ],
212212 ],
213+ 'upload_wrong_png ' => [
214+ 'file ' => [
215+ 'copy_file ' => true ,
216+ 'name ' => 'magento_wrong.png ' ,
217+ 'type ' => 'image/png ' ,
218+ 'current_path ' => '/../../../../_files ' ,
219+ ],
220+ 'expectation ' => [
221+ 'message ' => 'Something went wrong while saving the file(s). ' ,
222+ 'errorcode ' => 0 ,
223+ 'tmp_media_path ' => '/m/w/magento_wrong.png ' ,
224+ ],
225+ ]
213226 ];
214227 }
215228
You can’t perform that action at this time.
0 commit comments