Merge pull request #6989 from APriestman/7581_removeNamesFromExtractedFiles

7581 Remove name from extracted files
This commit is contained in:
Richard Cordovano 2021-05-26 13:23:18 -04:00 committed by GitHub
commit e81d17173f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 8 deletions

View File

@ -94,8 +94,8 @@ public final class EmbeddedFileExtractorIngestModule extends FileIngestModuleAda
*
*/
Case currentCase = Case.getCurrentCase();
String moduleDirAbsolute = Paths.get(currentCase.getModuleDirectory(), EmbeddedFileExtractorModuleFactory.getModuleName()).toString();
String moduleDirRelative = Paths.get(currentCase.getModuleOutputDirectoryRelativePath(), EmbeddedFileExtractorModuleFactory.getModuleName()).toString();
String moduleDirAbsolute = Paths.get(currentCase.getModuleDirectory(), EmbeddedFileExtractorModuleFactory.getOutputFolderName()).toString();
String moduleDirRelative = Paths.get(currentCase.getModuleOutputDirectoryRelativePath(), EmbeddedFileExtractorModuleFactory.getOutputFolderName()).toString();
if (refCounter.incrementAndGet(jobId) == 1) {
@ -217,15 +217,15 @@ public final class EmbeddedFileExtractorIngestModule extends FileIngestModuleAda
}
/**
* Creates a unique name for a file by concatentating the file name and the
* file object id.
* Creates a unique name for a file.
* Currently this is just the file object id to prevent long paths and illegal characters.
*
* @param file The file.
*
* @return The unique file name.
*/
static String getUniqueName(AbstractFile file) {
return file.getName() + "_" + file.getId();
return Long.toString(file.getId());
}
}

View File

@ -45,6 +45,10 @@ public class EmbeddedFileExtractorModuleFactory extends IngestModuleFactoryAdapt
public String getModuleDisplayName() {
return getModuleName();
}
static String getOutputFolderName() {
return "EFE";
}
@Override
public String getModuleDescription() {

View File

@ -112,8 +112,8 @@ public class ExtractArchiveWithPasswordAction extends AbstractAction {
protected Boolean doInBackground() {
boolean done = false;
try {
String moduleDirRelative = Paths.get(Case.getCurrentCaseThrows().getModuleOutputDirectoryRelativePath(), EmbeddedFileExtractorModuleFactory.getModuleName()).toString();
String moduleDirAbsolute = Paths.get(Case.getCurrentCaseThrows().getModuleDirectory(), EmbeddedFileExtractorModuleFactory.getModuleName()).toString();
String moduleDirRelative = Paths.get(Case.getCurrentCaseThrows().getModuleOutputDirectoryRelativePath(), EmbeddedFileExtractorModuleFactory.getOutputFolderName()).toString();
String moduleDirAbsolute = Paths.get(Case.getCurrentCaseThrows().getModuleDirectory(), EmbeddedFileExtractorModuleFactory.getOutputFolderName()).toString();
/*
* Construct a file type detector.
*/

View File

@ -724,7 +724,7 @@ class SevenZipExtractor {
if (checkForIngestCancellation(archiveFile)) {
return false;
}
final String uniqueExtractedName = FileUtil.escapeFileName(uniqueArchiveFileName + File.separator + (inArchiveItemIndex / 1000) + File.separator + inArchiveItemIndex + "_" + new File(pathInArchive).getName());
final String uniqueExtractedName = FileUtil.escapeFileName(uniqueArchiveFileName + File.separator + (inArchiveItemIndex / 1000) + File.separator + inArchiveItemIndex);
final String localAbsPath = moduleDirAbsolute + File.separator + uniqueExtractedName;
final String localRelPath = moduleDirRelative + File.separator + uniqueExtractedName;