You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2020/06/23 00:04:48 UTC

[airflow] 01/04: Fix tree view if config contains " (#9250)

This is an automated email from the ASF dual-hosted git repository.

kaxilnaik pushed a commit to branch v1-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 72af0a11b88e643ee35d74c537f10aaa9288fddb
Author: Igor Khrol <ig...@automattic.com>
AuthorDate: Mon Jun 15 13:08:34 2020 +0300

    Fix tree view if config contains " (#9250)
    
    If you run DAG with `{"\"": ""}` configuration tree view will be broken:
    ```
    tree:1 Uncaught SyntaxError: Unexpected string in JSON at position 806
        at JSON.parse (<anonymous>)
        at tree?dag_id=hightlight_test&num_runs=25:1190
    ```
    
    JSON.parse is given incorrectly escaped json string.
    
    (cherry-picked from a8cd23c8f04c29a3bc37e9a1aec2fbdf044116e4)
---
 airflow/www_rbac/templates/airflow/tree.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/airflow/www_rbac/templates/airflow/tree.html b/airflow/www_rbac/templates/airflow/tree.html
index 68723d3..b8d167c 100644
--- a/airflow/www_rbac/templates/airflow/tree.html
+++ b/airflow/www_rbac/templates/airflow/tree.html
@@ -138,7 +138,7 @@ function populate_taskinstance_properties(node) {
 
 var devicePixelRatio = window.devicePixelRatio || 1;
 // JSON.parse is faster for large payloads than an object literal (because the JSON grammer is simpler!)
-var data = JSON.parse('{{ data }}');
+var data = JSON.parse({{ data|tojson }});
 var barHeight = 20;
 var axisHeight = 40;
 var square_x = parseInt(500 * devicePixelRatio);