From f359ed3750a0057549f45cd4feb74b441a170522 Mon Sep 17 00:00:00 2001 From: nscuro Date: Sun, 10 Nov 2024 23:34:44 +0100 Subject: [PATCH] Fix tags with special characters breaking the tags table Fixes #1081 Signed-off-by: nscuro --- src/views/portfolio/tags/TagList.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/views/portfolio/tags/TagList.vue b/src/views/portfolio/tags/TagList.vue index 0593e0a2..0636cf64 100644 --- a/src/views/portfolio/tags/TagList.vue +++ b/src/views/portfolio/tags/TagList.vue @@ -23,6 +23,8 @@ import TaggedNotificationRuleListModal from '@/views/portfolio/tags/TaggedNotifi import TaggedPoliciesListModal from '@/views/portfolio/tags/TaggedPoliciesListModal.vue'; import TaggedProjectListModal from '@/views/portfolio/tags/TaggedProjectListModal.vue'; import i18n from '@/i18n'; +import MurmurHash2 from 'imurmurhash'; + export default { mixins: [bootstrapTableMixin, permissionsMixin, routerMixin], components: { @@ -195,7 +197,7 @@ export default { }, buttonsOrder: ['btnDeleteSelected', 'refresh', 'columns'], clickToSelect: true, - uniqueId: 'name', + uniqueId: 'nameHash', search: true, showColumns: true, showRefresh: true, @@ -212,6 +214,11 @@ export default { refresh: 'fa-refresh', }, responseHandler: function (res, xhr) { + for (let tag of res) { + // Tag names with special characters can break table rendering. + // https://github.com/DependencyTrack/dependency-track/issues/4357 + tag.nameHash = MurmurHash2(tag.name).result(); + } res.total = xhr.getResponseHeader('X-Total-Count'); return res; },