diff --git a/scripts/pi-hole/js/groups-adlists.js b/scripts/pi-hole/js/groups-adlists.js
index 271e08a6..df660bdb 100644
--- a/scripts/pi-hole/js/groups-adlists.js
+++ b/scripts/pi-hole/js/groups-adlists.js
@@ -88,7 +88,7 @@ function initTable() {
$("td:eq(2)", row).html('');
var commentEl = $("#comment_" + data.id, row);
- commentEl.val(data.comment);
+ commentEl.val(utils.unescapeHtml(data.comment));
commentEl.on("change", editAdlist);
$("td:eq(3)", row).empty();
diff --git a/scripts/pi-hole/js/groups-clients.js b/scripts/pi-hole/js/groups-clients.js
index ad987153..322c2396 100644
--- a/scripts/pi-hole/js/groups-clients.js
+++ b/scripts/pi-hole/js/groups-clients.js
@@ -132,7 +132,7 @@ function initTable() {
$("td:eq(1)", row).html('');
var commentEl = $("#comment_" + data.id, row);
- commentEl.val(data.comment);
+ commentEl.val(utils.unescapeHtml(data.comment));
commentEl.on("change", editClient);
$("td:eq(2)", row).empty();
diff --git a/scripts/pi-hole/js/groups-domains.js b/scripts/pi-hole/js/groups-domains.js
index 911eaa01..42df3bff 100644
--- a/scripts/pi-hole/js/groups-domains.js
+++ b/scripts/pi-hole/js/groups-domains.js
@@ -149,7 +149,7 @@ function initTable() {
$("td:eq(3)", row).html('');
var commentEl = $("#comment_" + data.id, row);
- commentEl.val(data.comment);
+ commentEl.val(utils.unescapeHtml(data.comment));
commentEl.on("change", editDomain);
// Show group assignment field only if in full domain management mode
diff --git a/scripts/pi-hole/js/groups.js b/scripts/pi-hole/js/groups.js
index f59dd1b0..016610ef 100644
--- a/scripts/pi-hole/js/groups.js
+++ b/scripts/pi-hole/js/groups.js
@@ -43,7 +43,7 @@ $(function () {
''
);
var nameEl = $("#name_" + data.id, row);
- nameEl.val(data.name);
+ nameEl.val(utils.unescapeHtml(data.name));
nameEl.on("change", editGroup);
var disabled = data.enabled === 0;
@@ -63,7 +63,7 @@ $(function () {
$("td:eq(2)", row).html('');
var desc = data.description !== null ? data.description : "";
var descEl = $("#desc_" + data.id, row);
- descEl.val(desc);
+ descEl.val(utils.unescapeHtml(desc));
descEl.on("change", editGroup);
$("td:eq(3)", row).empty();
diff --git a/scripts/pi-hole/js/utils.js b/scripts/pi-hole/js/utils.js
index 002f4c30..6fe90245 100644
--- a/scripts/pi-hole/js/utils.js
+++ b/scripts/pi-hole/js/utils.js
@@ -22,6 +22,20 @@ function escapeHtml(text) {
});
}
+function unescapeHtml(text) {
+ var map = {
+ "&": "&",
+ "<": "<",
+ ">": ">",
+ """: '"',
+ "'": "'"
+ };
+
+ return text.replace(/&(?:amp|lt|gt|quot|#039);/g, function (m) {
+ return map[m];
+ });
+}
+
// Helper function for converting Objects to Arrays after sorting the keys
function objectToArray(obj) {
var arr = [];
@@ -233,6 +247,7 @@ function getGraphType() {
window.utils = (function () {
return {
escapeHtml: escapeHtml,
+ unescapeHtml: unescapeHtml,
objectToArray: objectToArray,
padNumber: padNumber,
showAlert: showAlert,