Skip to content

Commit

Permalink
ZoneMinder#724 and general, filter out cake error leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
pliablepixels committed Oct 21, 2018
1 parent 7c34565 commit 5af4141
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions www/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,14 @@ angular.module('zmApp', [
}

//console.log ("HTTP response");


if (response.data && typeof(response.data) == 'string' && response.data.indexOf("<pre class=\"cake-error\">") != -1) {
console.log ("cake error detected, attempting fix...");
response.data = JSON.parse(response.data.replace(/<pre class=\"cake-error\">[\s\S]*<\/pre>/,''));
//console.log ("FIXED="+response.data);
}
//"data":"<pre class=\"cake-error\">
return response;
}

Expand Down Expand Up @@ -2340,6 +2348,13 @@ angular.module('zmApp', [
});
return d.promise;
} else {

// work around for cake-error leak
if (succ.data.indexOf("<pre class=\"cake-error\">") != -1) {
logger.debug ("**** Native: cake-error in message, trying fix...");
succ.data = JSON.parse(succ.data.replace(/<pre class=\"cake-error\">[\s\S]*<\/pre>/,''));
}

try {
d.resolve({
"data": JSON.parse(succ.data)
Expand Down

0 comments on commit 5af4141

Please sign in to comment.