From 54462c26f20dea9f81554a9bdb536d693e431a19 Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sun, 16 Apr 2023 15:38:49 +0200 Subject: [PATCH] WebAdmin: display undefined js objects as empty string This is probably something that changed in the recent datatables update, before it was handled automatically Signed-off-by: Nicola Murino --- templates/webadmin/events.html | 9 +++++++++ templates/webadmin/iplists.html | 3 +++ 2 files changed, 12 insertions(+) diff --git a/templates/webadmin/events.html b/templates/webadmin/events.html index fb0ab908..dd0fc1b8 100644 --- a/templates/webadmin/events.html +++ b/templates/webadmin/events.html @@ -414,6 +414,9 @@ along with this program. If not, see . "defaultContent": "", "render": function (data, type, row) { if (type === 'display') { + if (!data){ + return ""; + } return escapeHTML(data); } return data; @@ -492,6 +495,9 @@ along with this program. If not, see . "data": "virtual_path", "render": function (data, type, row) { if (type === 'display') { + if (!data){ + return ""; + } let ellipsisFn = $.fn.dataTable.render.ellipsis(70, true, true); if (row["virtual_target_path"]){ return ellipsisFn(`${data} => ${row["virtual_target_path"]}`,type); @@ -505,6 +511,9 @@ along with this program. If not, see . "data": "username", "defaultContent": "", "render": function (data, type, row) { + if (!data){ + return ""; + } if (type === 'display') { return escapeHTML(data); } diff --git a/templates/webadmin/iplists.html b/templates/webadmin/iplists.html index d4286bd2..a8afaa45 100644 --- a/templates/webadmin/iplists.html +++ b/templates/webadmin/iplists.html @@ -455,6 +455,9 @@ $(document).ready(function () { "data": "description", "render": function (data, type, row) { if (type === 'display') { + if (!data){ + return ""; + } let ellipsisFn = $.fn.dataTable.render.ellipsis(70, true, true); return ellipsisFn(data,type); }