Skip to content

Commit fa58abb

Browse files
committed
Merge remote-tracking branch 'origin/AC-10720' into GL_PR_Arrows_Jan_19_2024
2 parents e2da584 + a0bf40d commit fa58abb

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ define([
7474
$.mage.__('We could not detect a size.') :
7575
byteConvert(currentFile.size);
7676

77+
// check if file is allowed to upload and resize
78+
allowedResize = $.inArray(currentFile.extension, allowedExt) !== -1;
79+
80+
if (!allowedResize) {
81+
fileUploader.aggregateError(currentFile.name,
82+
$.mage.__('Disallowed file type.'));
83+
fileUploader.onLoadingStop();
84+
return false;
85+
}
86+
7787
fileId = Math.random().toString(33).substr(2, 18);
7888

7989
tmpl = progressTmpl({
@@ -91,9 +101,6 @@ define([
91101
tempFileId: fileId
92102
};
93103

94-
// check if resize allowed for file extension
95-
allowedResize = $.inArray(currentFile.extension, allowedExt) !== -1;
96-
97104
$(tmpl).appendTo(self.element);
98105
return modifiedFile;
99106
},

app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ define([
6868
if (fileInput !== undefined) {
6969
let targetElement = $(fileInput).closest('.file-uploader-area')[0],
7070
dropTargetElement = $(fileInput).closest(this.dropZone)[0],
71-
fileObj = [],
7271
formKey = window.FORM_KEY !== undefined ? window.FORM_KEY : $.cookie('form_key'),
7372
fileInputName = this.fileInputName,
7473
arrayFromObj = Array.from,
@@ -105,12 +104,8 @@ define([
105104
}
106105

107106
if (!allowed.passed) {
108-
fileObj.push(currentFile);
109107
this.aggregateError(file.name, allowed.message);
110-
111-
if (this.aggregatedErrors.length === fileObj.length) {
112-
this.uploaderConfig.stop();
113-
}
108+
this.uploaderConfig.stop();
114109
return false;
115110
}
116111

0 commit comments

Comments
 (0)