diff --git a/scripts/pi-hole/js/search.js b/scripts/pi-hole/js/search.js index dae432ec8..521fdb661 100644 --- a/scripts/pi-hole/js/search.js +++ b/scripts/pi-hole/js/search.js @@ -91,11 +91,11 @@ function eventsource(partial) { // Group results in res.gravity by res.gravity[].address var grouped = {}; for (const list of res.gravity) { - if (grouped[list.address] === undefined) { - grouped[list.address] = []; + if (grouped[list.address + "_" + list.type] === undefined) { + grouped[list.address + "_" + list.type] = []; } - grouped[list.address].push(list); + grouped[list.address + "_" + list.type].push(list); } const numLists = Object.keys(grouped).length; @@ -112,14 +112,14 @@ function eventsource(partial) { "'" + (numLists > 0 ? ":" : ".") + "

"; - for (const address of Object.keys(grouped)) { - const list = grouped[address][0]; + for (const listId of Object.keys(grouped)) { + const list = grouped[listId][0]; const color = list.type === "block" ? "red" : "green"; result += " - " + - utils.escapeHtml(address) + + utils.escapeHtml(list.address) + "
" + @@ -144,7 +144,7 @@ function eventsource(partial) { ? '
comment: "' + utils.escapeHtml(list.comment) + '"' : "
no comment") + "
matching entries:
"; - for (const lists of grouped[address]) { + for (const lists of grouped[listId]) { result += " - " + utils.escapeHtml(lists.domain) + "
"; }