You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
The issue still exists against the latest master branch of bootstrap-fileinput.
This is not an usage question. I confirm having read the plugin documentation and demos.
This is not a general programming / coding question. (Those should be directed to the webtips Q & A forum).
I have attempted to find the simplest possible steps to reproduce the issue.
I have included a failing test as a pull request (Optional).
Steps to reproduce the issue
Added custom validation to 'filebatchpreupload' event (validation not needed to reproduce issue)
this.element.on('filebatchpreupload', function(event, data, previewId, index) {
return {
message: "too many files!"
};
});
As soon as the validation fails and uploads are cancelled, the issue happens on line 3140, saying 'self.ajaxAborted' is undefined.
As far as i debugged the code, i encountered that self.ajaxAborted will be overwritten by the 'fileenable' event raised some lines above:
-> 3138: self.cancel();
-> 3247: self.unlock();
-> 3218: self.enable();
-> 3325: self._raise('fileenabled');
-> 990: self.ajaxAborted = e.result;
Undefined will be written into self.ajaxAborted.
So on line 3140 there wont be a message accessible anymore.
self._showUploadError(self.ajaxAborted.message, data, 'filecustomerror');
Therefore the custom error message won't be displayed.
A possible solution could be:
to move line 3138 after line 3140
or
instead of using self.ajaxAborted.message, use data.abortMessage as a parameter for _showUploadError.
Libraries
jQuery version: 1.11.3
bootstrap-fileinput version: 4.4.0
The text was updated successfully, but these errors were encountered:
Prerequisites
master
branch of bootstrap-fileinput.Steps to reproduce the issue
this.element.on('filebatchpreupload', function(event, data, previewId, index) {
return {
message: "too many files!"
};
});
-> 3138: self.cancel();
-> 3247: self.unlock();
-> 3218: self.enable();
-> 3325: self._raise('fileenabled');
-> 990: self.ajaxAborted = e.result;
Undefined will be written into self.ajaxAborted.
So on line 3140 there wont be a message accessible anymore.
self._showUploadError(self.ajaxAborted.message, data, 'filecustomerror');
Therefore the custom error message won't be displayed.
A possible solution could be:
or
Libraries
The text was updated successfully, but these errors were encountered: