From ee89410319ccd805a430a52fe2ff226430600304 Mon Sep 17 00:00:00 2001 From: nscuro Date: Sat, 31 Aug 2024 23:44:20 +0200 Subject: [PATCH] Fix project being rendered as PURL in email notifications See https://github.com/DependencyTrack/dependency-track/issues/3978#issuecomment-2323046771 for details. Fixes #3978 Signed-off-by: nscuro --- src/main/resources/templates/notification/publisher/email.peb | 4 ++-- .../notification/publisher/SendMailPublisherTest.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/templates/notification/publisher/email.peb b/src/main/resources/templates/notification/publisher/email.peb index 2e09ce5fca..eb435d439d 100644 --- a/src/main/resources/templates/notification/publisher/email.peb +++ b/src/main/resources/templates/notification/publisher/email.peb @@ -20,7 +20,7 @@ Other affected projects: Project: [{{ affectedProject.name }} : {{ affectedProject.version }}] Project URL: {{ baseUrl }}/projects/{{ affectedProject.uuid }} {% endif %}{% endfor %}{% endif %}{% elseif notification.group == "NEW_VULNERABLE_DEPENDENCY" %} -Project: {{ subject.component.project.toString }} +Project: [{{ subject.component.project.name }} : {{ subject.component.project.version }}] Project URL: {{ baseUrl }}/projects/{{ subject.component.project.uuid }} Component: {{ subject.component.toString }} Component URL: {{ baseUrl }}/component/?uuid={{ subject.component.uuid }} @@ -55,7 +55,7 @@ Source: {{ subject.vulnerability.source }} {% endif %} Component: {{ subject.component.toString }} Component URL: {{ baseUrl }}/component/?uuid={{ subject.component.uuid }} -Project: {{ subject.component.project.toString }} +Project: [{{ subject.component.project.name }} : {{ subject.component.project.version }}] Description: {{ subject.component.project.description }} Project URL: {{ baseUrl }}/projects/{{ subject.component.project.uuid }} {% if notification.subject.affectedProjects|length > 1%} diff --git a/src/test/java/org/dependencytrack/notification/publisher/SendMailPublisherTest.java b/src/test/java/org/dependencytrack/notification/publisher/SendMailPublisherTest.java index 4b038b2ec8..192578f1af 100644 --- a/src/test/java/org/dependencytrack/notification/publisher/SendMailPublisherTest.java +++ b/src/test/java/org/dependencytrack/notification/publisher/SendMailPublisherTest.java @@ -327,7 +327,7 @@ public void testInformWithNewVulnerableDependencyNotification() { -------------------------------------------------------------------------------- - Project: pkg:maven/org.acme/projectName@projectVersion + Project: [projectName : projectVersion] Project URL: /projects/c9c9539a-e381-4b36-ac52-6a7ab83b2c95 Component: componentName : componentVersion Component URL: /component/?uuid=94f87321-a5d1-4c2f-b2fe-95165debebc6 @@ -380,7 +380,7 @@ public void testInformWithProjectAuditChangeNotification() { Component: componentName : componentVersion Component URL: /component/?uuid=94f87321-a5d1-4c2f-b2fe-95165debebc6 - Project: pkg:maven/org.acme/projectName@projectVersion + Project: [projectName : projectVersion] Description: projectDescription Project URL: /projects/c9c9539a-e381-4b36-ac52-6a7ab83b2c95