Improved file reader detection

This commit is contained in:
eugene.livis 2023-06-07 16:28:00 -04:00
parent 3fe6482b42
commit 816f166af1

View File

@ -520,6 +520,15 @@ public class ExtractedTextViewer implements TextViewer {
return false;
}
// Often times there is an exception when trying to initiale a reader,
// thus making that specific file "unsupported". The only way to identify
// this situation is to initialize the reader.
try {
FileReaderExtractedText tmp = new FileReaderExtractedText(file);
} catch (TextExtractorFactory.NoTextExtractorFound | TextExtractor.InitReaderException ex) {
return false;
}
return true;
}