Skip to content

Commit

Permalink
Fix the wrong escaping on settings datatable
Browse files Browse the repository at this point in the history
Signed-off-by: rdwebdesign <github@rdwebdesign.com.br>
  • Loading branch information
rdwebdesign committed Jan 29, 2022
1 parent a302e9f commit 14f3aab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
15 changes: 14 additions & 1 deletion scripts/pi-hole/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,22 @@ $(function () {
columnDefs: [
{ bSortable: false, orderable: false, targets: -1 },
{
targets: [0, 1, 2],
targets: [0, 1],
render: $.fn.dataTable.render.text(),
},
{
targets: 2,
render: function (data, type, row) {
// Show "unknown", when host is "*"
if (data == "*") {
return "<i>unknown</i>";
} else {
return typeof data === "string"
? data.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;")
: data;
}
},
},
],
paging: true,
order: [[2, "asc"]],
Expand Down
3 changes: 0 additions & 3 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,6 @@ function convertseconds($argument)
}

$host = htmlentities($line[3]);
if ($host == "*") {
$host = "<i>unknown</i>";
}

$clid = $line[4];
if ($clid == "*") {
Expand Down

0 comments on commit 14f3aab

Please sign in to comment.