From ef8fad53107d7d13040856763cd7fd2edced50fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominique=20Eifl=C3=A4nder?= Date: Thu, 12 Aug 2021 09:48:03 +0200 Subject: [PATCH] RED-1982: Fixed image dossier attribute in excel reports --- .../service/ExcelTemplateReportGenerationService.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ExcelTemplateReportGenerationService.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ExcelTemplateReportGenerationService.java index ecd8f8a..624c35f 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ExcelTemplateReportGenerationService.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ExcelTemplateReportGenerationService.java @@ -78,8 +78,13 @@ public class ExcelTemplateReportGenerationService { for (DossierAttributeConfig attribute : dossierAttributesConfig.getDossierAttributeConfigs()) { if (dossierAttribute.getDossierAttributeId().equals(attribute.getId())) { if (attribute.getType().equals(DossierAttributeConfig.DossierAttributeType.IMAGE)) { - imagePlaceholders.add(new ImagePlaceholder(attribute.getPlaceholder(), Base64.getDecoder() - .decode(dossierAttribute.getValue()))); + if (dossierAttribute.getValue().startsWith("data:")) { + imagePlaceholders.add(new ImagePlaceholder(attribute.getPlaceholder(), Base64.getDecoder() + .decode(dossierAttribute.getValue().split(",")[1]))); + } else { + imagePlaceholders.add(new ImagePlaceholder(attribute.getPlaceholder(), Base64.getDecoder() + .decode(dossierAttribute.getValue()))); + } } else { dossierAttributesPlaceholder.put(attribute.getPlaceholder(), dossierAttribute.getValue()); }