From 4bfc6ad8af9679f35c6a6c46ff43a8790897388a Mon Sep 17 00:00:00 2001 From: "Samuel H. Kenyon" Date: Tue, 29 Apr 2014 14:01:51 -0400 Subject: [PATCH] file association works now --- .../ExternalResultsIngestModule.java | 2 +- .../externalresults/ExternalResultsUtility.java | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/externalresults/ExternalResultsIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/externalresults/ExternalResultsIngestModule.java index 9fc9dfd0e7..5017429cbc 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/externalresults/ExternalResultsIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/externalresults/ExternalResultsIngestModule.java @@ -78,7 +78,7 @@ public class ExternalResultsIngestModule extends IngestModuleAdapter implements } ///@todo use a standard name or search for an XML file - importFilePath = importPath + File.separator + "ext-test5.xml"; + importFilePath = importPath + File.separator + "ext-test6.xml"; } } diff --git a/Core/src/org/sleuthkit/autopsy/modules/externalresults/ExternalResultsUtility.java b/Core/src/org/sleuthkit/autopsy/modules/externalresults/ExternalResultsUtility.java index a9dc4a7365..67bf656167 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/externalresults/ExternalResultsUtility.java +++ b/Core/src/org/sleuthkit/autopsy/modules/externalresults/ExternalResultsUtility.java @@ -24,7 +24,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.logging.Level; -import org.openide.util.Exceptions; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.IngestServices; @@ -99,13 +98,19 @@ public class ExternalResultsUtility { } } - // get associated file (if any) to use as the content + // Get associated file (if any) to use as the content obj to attach the artifact to Content currContent = null; - - //for (String filePath : art.files) { if (art.files.size() > 0) { String filePath = art.files.get(0).path; - List files = Case.getCurrentCase().getSleuthkitCase().findFiles(defaultDataSource, filePath); + String fileName = filePath; + String parentPath = ""; + int charPos = filePath.lastIndexOf("/"); + if (charPos > 0) { + fileName = filePath.substring(charPos + 1); + parentPath = filePath.substring(0, charPos + 1); + } + String whereQuery = "name='" + fileName + "' AND parent_path='" + parentPath + "'"; //NON-NLS + List files = Case.getCurrentCase().getSleuthkitCase().findAllFilesWhere(whereQuery); if (files.size() > 0) { currContent = files.get(0); if (files.size() > 1) {