From 8e34a5c7d2e5969d72a2a469e8c97ad7fc7de712 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Sat, 20 Oct 2018 20:20:03 -0400 Subject: #724 and general, filter out cake error leaks --- www/js/app.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'www/js') diff --git a/www/js/app.js b/www/js/app.js index 8a8cfd55..4e146384 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -714,6 +714,14 @@ angular.module('zmApp', [ } //console.log ("HTTP response"); + + + if (response.data && typeof(response.data) == 'string' && response.data.indexOf("
") != -1) {
+            console.log ("cake error detected, attempting fix...");
+            response.data = JSON.parse(response.data.replace(/
[\s\S]*<\/pre>/,''));
+            //console.log ("FIXED="+response.data);
+        }
+        //"data":"
         return response;
       }
 
@@ -2340,6 +2348,13 @@ angular.module('zmApp', [
                 });
                 return d.promise;
               } else {
+
+                // work around for cake-error leak
+                if (succ.data.indexOf("
") != -1) {
+                  logger.debug ("**** Native: cake-error in message, trying fix...");
+                  succ.data = JSON.parse(succ.data.replace(/
[\s\S]*<\/pre>/,''));
+                }
+
                 try {
                   d.resolve({
                     "data": JSON.parse(succ.data)
-- 
cgit v1.2.3