From b6444dcb5c6530bafb19e1054ad8f18108b45f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Berenguel?= Date: Wed, 4 Sep 2024 11:16:26 -0300 Subject: [PATCH] #2286: use replaced ufed:Id (UfedXmlReader) as Communication:ID --- .../src/main/java/iped/parsers/ufed/UFEDChatParser.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/UFEDChatParser.java b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/UFEDChatParser.java index 5995767321..b89abce94b 100644 --- a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/UFEDChatParser.java +++ b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/UFEDChatParser.java @@ -10,12 +10,14 @@ import java.util.Date; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; +import org.apache.commons.lang3.StringUtils; import org.apache.tika.config.Field; import org.apache.tika.exception.TikaException; import org.apache.tika.extractor.EmbeddedDocumentExtractor; @@ -156,7 +158,7 @@ public void parse(InputStream inputStream, ContentHandler handler, Metadata meta if (subitemRefs.length > 0) { String subitemRefsQuery = "(" + Arrays.asList(subitemRefs).stream().collect(Collectors.joining(") (")) + ")"; searcher.searchIterable(subitemRefsQuery).forEach(subitems::add); - } else { + } else if (attach.getMetadata().get(ExtraProperties.UFED_META_PREFIX + "ContentType") != null) { subitems.add(attach); } } @@ -223,7 +225,10 @@ public void parse(InputStream inputStream, ContentHandler handler, Metadata meta } // Communication:ID - chatMetadata.set(ExtraProperties.COMMUNICATION_ID, chat.getMetadata().get(ExtraProperties.UFED_META_PREFIX + "Id")); + String id = chat.getMetadata().get(ExtraProperties.UFED_META_PREFIX + "Identifier"); + if (id != null) { + chatMetadata.set(ExtraProperties.COMMUNICATION_ID, id); + } // Communication:Account String ufedAccount = chat.getMetadata().get(ExtraProperties.UFED_META_PREFIX + "Account");