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()
108
108
109
109
$ result ['url ' ] = $ this ->productMediaConfig ->getTmpMediaUrl ($ result ['file ' ]);
110
110
$ result ['file ' ] = $ result ['file ' ] . '.tmp ' ;
111
- } catch (\ Exception $ e ) {
111
+ } catch (LocalizedException $ e ) {
112
112
$ result = ['error ' => $ e ->getMessage (), 'errorcode ' => $ e ->getCode ()];
113
+ } catch (\Throwable $ e ) {
114
+ $ result = ['error ' => 'Something went wrong while saving the file(s). ' , 'errorcode ' => 0 ];
113
115
}
114
116
115
117
/** @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
198
198
'current_path ' => '/../../../../_files ' ,
199
199
],
200
200
'expectation ' => [
201
- 'message ' => 'Wrong file size . ' ,
201
+ 'message ' => 'Something went wrong while saving the file(s) . ' ,
202
202
'errorcode ' => 0 ,
203
203
'tmp_media_path ' => '/m/a/magento_empty.jpg ' ,
204
204
],
205
205
],
206
206
'upload_without_image ' => [
207
207
'file ' => [],
208
208
'expectation ' => [
209
- 'message ' => '$_FILES array is empty ' ,
209
+ 'message ' => 'Something went wrong while saving the file(s). ' ,
210
210
'errorcode ' => 0 ,
211
211
],
212
212
],
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
+ ]
213
226
];
214
227
}
215
228
You can’t perform that action at this time.
0 commit comments