Merge pull request #4235 from humhub/fix/dataTypeErrorOnAjaxError

Fix: Misleading error message 'Unable to determine dataType from resp…
This commit is contained in:
buddh4 2020-07-15 11:04:07 +02:00 committed by GitHub
commit 0ed0c2a29e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -30,4 +30,5 @@ HumHub Change Log
- Fix #4227: Removed redundant code from `humhub.ui.widget.js`
- Fix #4232: Metadata request creates guest session if CSP nonce header is enabled
- Enh #4234: Enhanced custom test environment configuration in `@protected/humhub/tests/config/env/env.php` file
- Fix #4233: `humhub\modules\web\security\helpers\Security:setNonce()` does not remove nonce session value if nonce is null
- Fix #4233: `humhub\modules\web\security\helpers\Security:setNonce()` does not remove nonce session value if nonce is null
- Fix #4235: Misleading error message 'Unable to determine dataType from response' logged on ajax error

View File

@ -25,10 +25,11 @@ humhub.module('client', function (module, require, $) {
dataType = 'json';
} else if (responseType && responseType.indexOf('html') > -1) {
dataType = 'html';
} else if(!this.isAbort()){
console.error('unable to determine dataType from response, this may cause problems.');
} else if(!this.isAbort() && !this.isError()){
console.error('Unable to determine dataType from response, this may cause problems.');
}
}
this.dataType = dataType;
// If we expect json and received json we merge the json result with our response object.
@ -40,7 +41,11 @@ humhub.module('client', function (module, require, $) {
};
Response.prototype.isAbort = function () {
return this.textStatus == "abort";
return this.textStatus === "abort";
};
Response.prototype.isError = function () {
return this.textStatus === "error";
};
Response.prototype.header = function (key) {