From 46133acd775e03a2ef68f46a78afe0a6d78d7f6f Mon Sep 17 00:00:00 2001 From: Eugene Livis Date: Mon, 20 Oct 2014 13:18:50 -0400 Subject: [PATCH] added support for cases when file info attrubutes are not available --- .../sevenzip/SevenZipIngestModule.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/sevenzip/SevenZipIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/sevenzip/SevenZipIngestModule.java index c7faf6b5a7..6eeb555a9e 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/sevenzip/SevenZipIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/sevenzip/SevenZipIngestModule.java @@ -284,12 +284,23 @@ public final class SevenZipIngestModule implements FileIngestModule { if (detectedFormat == null) { logger.log(Level.WARNING, "Could not detect format for file: " + archiveFile); //NON-NLS + + // if we don't have attribute info then use file extension + String extension = archiveFile.getNameExtension(); + if ("rar".equals(extension)) + { + // for RAR files we need to open them explicitly as RAR. Otherwise, if there is a ZIP archive inside RAR archive + // it will be opened incorrectly when using 7zip's built-in auto-detect functionality + return RAR; + } + + // Otherwise open the archive using 7zip's built-in auto-detect functionality return null; } else if (detectedFormat.contains("application/x-rar-compressed")) { - // EL: for RAR files we need to open them explicitly as RAR. Otherwise, if there is a ZIP archive inside RAR archive - // it will be opened incorrectly when using 7zip's built-in auto-detect functionality (see VIK-619). + // for RAR files we need to open them explicitly as RAR. Otherwise, if there is a ZIP archive inside RAR archive + // it will be opened incorrectly when using 7zip's built-in auto-detect functionality return RAR; } @@ -339,8 +350,9 @@ public final class SevenZipIngestModule implements FileIngestModule { try { stream = new SevenZipContentReadStream(new ReadContentInputStream(archiveFile)); - // EL: for RAR files we need to open them explicitly as RAR. Otherwise, if there is a ZIP archive inside RAR archive - // it will be opened incorrectly when using 7zip's built-in auto-detect functionality (see VIK-619). + // for RAR files we need to open them explicitly as RAR. Otherwise, if there is a ZIP archive inside RAR archive + // it will be opened incorrectly when using 7zip's built-in auto-detect functionality. + // All other archive formats are still opened using 7zip built-in auto-detect functionality. ArchiveFormat options = get7ZipOptions(archiveFile); inArchive = SevenZip.openInArchive(options, stream);