From 0f6acfe53be4794e3b77fb841ff177e0b4e3651f Mon Sep 17 00:00:00 2001 From: millmanorama Date: Thu, 9 Nov 2017 15:55:56 +0100 Subject: [PATCH] messages could have attachments too --- .../contentviewers/MessageContentViewer.java | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java index 6a06e2d1da..ea19ffe1ad 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java @@ -521,23 +521,28 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont configureTextArea(TSK_EMAIL_CONTENT_HTML, HTML_TAB_INDEX); configureTextArea(TSK_EMAIL_CONTENT_RTF, RTF_TAB_INDEX); - //TODO: Replace this with code to get the actual attachements! - final Set attachments = artifact.getDataSource().getChildren().stream() - .filter(AbstractFile.class::isInstance) - .map(AbstractFile.class::cast) - .collect(Collectors.toSet()); - final int numberOfAttachments = attachments.size(); - - msgbodyTabbedPane.setEnabledAt(4, numberOfAttachments > 0); - msgbodyTabbedPane.setTitleAt(4, "Attachments (" + numberOfAttachments + ")"); - drp.setNode(new TableFilterNode(new DataResultFilterNode(new AbstractNode( - new AttachmentsChildren(attachments)), null), true)); + + configureAttachments(); } catch (TskCoreException ex) { LOGGER.log(Level.WARNING, "Failed to get attributes for email message.", ex); //NON-NLS } } + private void configureAttachments() throws TskCoreException { + //TODO: Replace this with code to get the actual attachements! + final Set attachments = artifact.getChildren().stream() + .filter(AbstractFile.class::isInstance) + .map(AbstractFile.class::cast) + .collect(Collectors.toSet()); + final int numberOfAttachments = attachments.size(); + + msgbodyTabbedPane.setEnabledAt(4, numberOfAttachments > 0); + msgbodyTabbedPane.setTitleAt(4, "Attachments (" + numberOfAttachments + ")"); + drp.setNode(new TableFilterNode(new DataResultFilterNode(new AbstractNode( + new AttachmentsChildren(attachments)), null), true)); + } + private static String wrapInHtmlBody(String htmlText) { return "" + htmlText + ""; } @@ -565,8 +570,7 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont msgbodyTabbedPane.setEnabledAt(HDR_TAB_INDEX, false); msgbodyTabbedPane.setEnabledAt(HDR_TAB_INDEX, false); configureTextArea(TSK_TEXT, TEXT_TAB_INDEX); - msgbodyTabbedPane.setEnabledAt(ATTM_TAB_INDEX, false); - msgbodyTabbedPane.setTitleAt(ATTM_TAB_INDEX, "Attachments"); + configureAttachments(); } catch (TskCoreException ex) { LOGGER.log(Level.WARNING, "Failed to get attributes for message.", ex); //NON-NLS } @@ -637,6 +641,8 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont ss.put(new NodeProperty<>("Size", "Size", "Size", file.getSize())); ss.put(new NodeProperty<>("Mime Type", "Mime Type", "Mime Type", file.getMIMEType())); ss.put(new NodeProperty<>("Known", "Known", "Known", file.getKnown().getName())); + + addTagProperty(ss); return s; }