From 23b66b9b1f461ba237391598c78b277728ef18c1 Mon Sep 17 00:00:00 2001
From: Andrea Zagli <azagli@libero.it>
Date: Sat, 25 Feb 2023 11:29:23 +0100
Subject: [PATCH] Escaped quote on field values.

---
 src/lib.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lib.rs b/src/lib.rs
index 764c1b1..2f3bd8c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -54,7 +54,7 @@ impl Field {
 			FType::Text => {
 				f.tmpl.add_raw_template("field", r#"{% if label %}<div class="mb-3">
  <label for="{{ name }}" class="form-label">{{ label }}</label>{% endif %}
- <input type="text" class="form-control{% if help %} is-invalid{% endif %}" name="{{ name }}" id="{{ name }}" {% if value %} value="{{ value }}" {% endif %} {% if disabled %} readonly {% endif %} {% if maxlen > 0 %}maxlength="{{ maxlen }}"{% endif %} {% if invisible %}style="display: none;"{% endif %}/>
+ <input type="text" class="form-control{% if help %} is-invalid{% endif %}" name="{{ name }}" id="{{ name }}" {% if value %} value="{{ value | replace(from='"', to="&quot;") }}" {% endif %} {% if disabled %} readonly {% endif %} {% if maxlen > 0 %}maxlength="{{ maxlen }}"{% endif %} {% if invisible %}style="display: none;"{% endif %}/>
  {% if help %}<div id="helpBox_{{ name }}_" class="invalid-feedback">{{ help }}</div>{% endif %}
  {% if label %}</div>{% endif %}"#);
 			},
@@ -63,7 +63,7 @@ impl Field {
 
 				f.tmpl.add_raw_template("field", r#"{% if label %}<div class="mb-3">
  <label for="{{ name }}" class="form-label">{{ label }}</label>{% endif %}
- <textarea class="form-control{%if help %} is-invalid{% endif %}" name="{{ name }}" id="{{ name }}" rows="{{ rows }}">{{ value }}</textarea>
+ <textarea class="form-control{%if help %} is-invalid{% endif %}" name="{{ name }}" id="{{ name }}" rows="{{ rows }}">{{ value | replace(from='"', to="&quot;") }}</textarea>
  {% if help %}<div id="helpBox_{{ name }}_" class="invalid-feedback">{{ help }}</div>{% endif %}
  {% if label %}</div>{% endif %}"#);
 			},
-- 
2.49.0