mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 00:16:16 +00:00
Don't load file if not needed
This commit is contained in:
parent
a9ac434e88
commit
e36417be26
@ -51,7 +51,7 @@ public class FileTypeDetector {
|
||||
private final List<FileType> userDefinedFileTypes;
|
||||
private final List<FileType> autopsyDefinedFileTypes;
|
||||
private static SortedSet<String> tikaDetectedTypes;
|
||||
private final int defaultBufferSize = 2048; // Number of bytes to initially read from the file. Should cover most signatures.
|
||||
private final int defaultBufferSize = 600; // Number of bytes to initially read from the file. Should cover most signatures.
|
||||
|
||||
private static final Object timingLock = new Object();
|
||||
private long totalFiles = 0;
|
||||
@ -219,7 +219,7 @@ public class FileTypeDetector {
|
||||
// Proceed for now - the error will likely get logged next time the file is read.
|
||||
bufLen = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If the file is a regular file, give precedence to user-defined custom
|
||||
* file types.
|
||||
@ -314,7 +314,7 @@ public class FileTypeDetector {
|
||||
*/
|
||||
file.setMIMEType(mimeType);
|
||||
|
||||
long endTime = java.lang.System.currentTimeMillis();
|
||||
long endTime = java.lang.System.currentTimeMillis();
|
||||
long elapsed = endTime - startTime;
|
||||
synchronized(timingLock) {
|
||||
totalFiles++;
|
||||
|
@ -128,6 +128,11 @@ public class FileTypeIdIngestModule implements FileIngestModule {
|
||||
* of CustomFileTypesManager.
|
||||
*/
|
||||
private FileType detectUserDefinedFileType(AbstractFile file) throws CustomFileTypesManager.CustomFileTypesException {
|
||||
|
||||
if (CustomFileTypesManager.getInstance().getUserDefinedFileTypes().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read in the beginning of the file once.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user