diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/caseuco/CaseUcoReportGenerator.java b/Core/src/org/sleuthkit/autopsy/report/modules/caseuco/CaseUcoReportGenerator.java index 7f1ee0d810..1aa8fd0a45 100755 --- a/Core/src/org/sleuthkit/autopsy/report/modules/caseuco/CaseUcoReportGenerator.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/caseuco/CaseUcoReportGenerator.java @@ -129,7 +129,7 @@ public final class CaseUcoReportGenerator { * @throws TskCoreException */ public void addFile(AbstractFile file, Content parentDataSource) throws IOException, TskCoreException { - addFile(file, parentDataSource, ""); + addFile(file, parentDataSource, null); } /** @@ -141,11 +141,11 @@ public final class CaseUcoReportGenerator { * addDataSource) prior to this call. Otherwise, the report may be invalid. * @param localPath The location of the file on secondary storage, somewhere * other than the case. Example: local disk. This value will be ignored if - * it is null or empty. + * it is null. * @throws IOException * @throws TskCoreException */ - public void addFile(AbstractFile file, Content parentDataSource, String localPath) throws IOException, TskCoreException { + public void addFile(AbstractFile file, Content parentDataSource, Path localPath) throws IOException, TskCoreException { String fileTraceId = getFileTraceId(file); //Create the Trace CASE node, which will contain attributes about some evidence. @@ -165,11 +165,11 @@ public final class CaseUcoReportGenerator { CASEPropertyBundle contentDataPropertyBundle = createContentDataBundle(file); fileTrace.addBundle(contentDataPropertyBundle); - if(!Strings.isNullOrEmpty(localPath)) { + if(localPath != null) { String urlTraceId = getURLTraceId(file); CASENode urlTrace = new CASENode(urlTraceId, "Trace"); CASEPropertyBundle urlPropertyBundle = new CASEPropertyBundle("URL"); - urlPropertyBundle.addProperty("fullValue", localPath); + urlPropertyBundle.addProperty("fullValue", localPath.toString()); urlTrace.addBundle(urlPropertyBundle); contentDataPropertyBundle.addProperty("dataPayloadReferenceUrl", urlTraceId); @@ -399,15 +399,28 @@ public final class CaseUcoReportGenerator { */ private final class CASENode { + private final String id; + private final String type; + //Dynamic properties added to this CASENode. - private final LinkedHashMap properties; + private final Map properties; private final List propertyBundle; public CASENode(String id, String type) { - propertyBundle = new ArrayList<>(); + this.id = id; + this.type = type; properties = new LinkedHashMap<>(); - addProperty("@id", id); - addProperty("@type", type); + propertyBundle = new ArrayList<>(); + } + + @JsonProperty("@id") + public String getId() { + return id; + } + + @JsonProperty("@type") + public String getType() { + return type; } @JsonAnyGetter diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/portablecase/PortableCaseReportModule.java b/Core/src/org/sleuthkit/autopsy/report/modules/portablecase/PortableCaseReportModule.java index b50aab8c9e..046331ca9f 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/portablecase/PortableCaseReportModule.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/portablecase/PortableCaseReportModule.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2019 Basis Technology Corp. + * Copyright 2019-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -570,7 +570,9 @@ public class PortableCaseReportModule implements ReportModule { if(!dataSourceHasBeenIncluded) { reportGenerator.addDataSource(dataSource, currentCase); } - reportGenerator.addFile(absFile, dataSource); + String subFolder = getExportSubfolder(absFile); + String fileName = absFile.getId() + "-" + FileUtil.escapeFileName(absFile.getName()); + reportGenerator.addFile(absFile, dataSource, Paths.get(FILE_FOLDER_NAME, subFolder, fileName)); Files.createFile(filePath); return true; }