1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-29 04:50:51 +02:00

[ticket/13771] Only handle valid JQHXR response objects

PHPBB3-13771
This commit is contained in:
Matt Friedman
2015-05-04 10:27:11 -07:00
parent 4a7f905c6a
commit c7a0b4479d

View File

@@ -262,10 +262,13 @@ phpbb.ajaxify = function(options) {
console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown);
}
phpbb.clearLoadingTimeout();
var errorText = false;
var responseText = $.parseJSON(jqXHR.responseText);
if (typeof responseText.message === 'string' && responseText.message.length > 0) {
errorText = responseText.message;
var responseText, errorText = false;
try {
responseText = JSON.parse(jqXHR.responseText);
responseText = responseText.message;
} catch (e) {}
if (typeof responseText === 'string' && responseText.length > 0) {
errorText = responseText;
}
else if (typeof errorThrown === 'string' && errorThrown.length > 0) {
errorText = errorThrown;