When passing the data from the jinja2 template to javascript make sure
we escape and parse the JSON to avoid any invalid values being interpreted.

Signed-off-by: Michael Wood <[email protected]>
---
 bitbake/lib/toaster/toastergui/templates/project.html | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/bitbake/lib/toaster/toastergui/templates/project.html 
b/bitbake/lib/toaster/toastergui/templates/project.html
index 6a81283..00fb2b4 100644
--- a/bitbake/lib/toaster/toastergui/templates/project.html
+++ b/bitbake/lib/toaster/toastergui/templates/project.html
@@ -335,13 +335,13 @@ angular.element(document).ready(function() {
   scope.urls.layers = "{% url 'layers' %}";
   scope.urls.targets = "{% url 'targets' %}";
   scope.urls.importlayer = "{% url 'importlayer'%}"
-  scope.project = {{prj|safe}};
-  scope.builds = {{builds|safe}};
-  scope.layers = {{layers|safe}};
-  scope.targets = {{targets|safe}};
-  scope.frequenttargets = {{freqtargets|safe}};
-  scope.machine = {{machine|safe}};
-  scope.releases = {{releases|safe}};
+  scope.project = JSON.parse ("{{prj|escapejs}}");
+  scope.builds = JSON.parse ("{{builds|escapejs}}");
+  scope.layers = JSON.parse ("{{layers|escapejs}}");
+  scope.targets = JSON.parse ("{{targets|escapejs}}");
+  scope.frequenttargets = JSON.parse ("{{freqtargets|escapejs}}");
+  scope.machine = JSON.parse ("{{machine|escapejs}}");
+  scope.releases = JSON.parse ("{{releases|escapejs}}");
 
   scope.zone1alerts = [];
   scope.zone2alerts = [];
-- 
1.9.1

-- 
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Reply via email to