Skip to content

Commit

Permalink
Merge pull request #373 from keeps/alindo-dev
Browse files Browse the repository at this point in the history
Environment variable to disable Tika AutoDetectParser characters limit
  • Loading branch information
hmiguim authored Nov 28, 2023
2 parents f11f282 + cfb69df commit 4015b89
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,14 @@ private static void detectMimeType(ViewerRow row, ViewerCell cell, String databa
AutoDetectParser parser = new AutoDetectParser();
Metadata metadata = new Metadata();

parser.parse(inputStream, new BodyContentHandler(), metadata, new ParseContext());
Boolean autoDetectParserNoLimit = ViewerFactory.getEnvBoolean("AUTO_DETECT_PARSER_NO_LIMIT", false);

if (autoDetectParserNoLimit) {
parser.parse(inputStream, new BodyContentHandler(-1), metadata, new ParseContext());
} else {
parser.parse(inputStream, new BodyContentHandler(), metadata, new ParseContext());
}

mimeType = metadata.get("Content-Type");
fileExtension = MimeTypes.getDefaultMimeTypes().forName(mimeType).getExtension();

Expand Down

0 comments on commit 4015b89

Please sign in to comment.