From f8a647dd798fefcb51be9db8ff32d1e4e77d5134 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Sat, 4 Aug 2018 19:37:31 +0200 Subject: T765: escape special characters on config formatting. --- lib/vyos1x_renderer.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/vyos1x_renderer.ml b/lib/vyos1x_renderer.ml index df2d7be..7ff4c4c 100644 --- a/lib/vyos1x_renderer.ml +++ b/lib/vyos1x_renderer.ml @@ -30,9 +30,9 @@ let make_indent indent level = String.make (level * indent) ' ' let render_values indent_str name values = match values with | [] -> Printf.sprintf "%s%s { }\n" indent_str name - | [v] -> Printf.sprintf "%s%s \"%s\"\n" indent_str name v + | [v] -> Printf.sprintf "%s%s \"%s\"\n" indent_str name (String.escaped v) | _ -> - let rendered = List.map (fun s -> Printf.sprintf "%s%s \"%s\"" indent_str name s) values in + let rendered = List.map (fun s -> Printf.sprintf "%s%s \"%s\"" indent_str name (String.escaped s)) values in let rendered = String.concat "\n" rendered in Printf.sprintf "%s\n" rendered -- cgit v1.2.3