Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix that a regular expression can be configured with a lenght.

I started adding matching movie files (mp4) etc and those are huge, so I dont want them in the memory :)
  • Loading branch information...
commit bbcd4e04f0d9cb0e60ad7ec98c40383d39e024d3 1 parent a2d6255
Seppel Hardt tuxBurner authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/main/java/net/sf/jmimemagic/MagicMatcher.java
5 src/main/java/net/sf/jmimemagic/MagicMatcher.java
View
@@ -186,7 +186,10 @@ public MagicMatch test(File f, boolean onlyMimeMatch)
} else if (type.equals("string")) {
length = match.getTest().capacity();
} else if (type.equals("regex")) {
- length = (int) file.length() - offset;
+
+
+ final int matchLength = match.getLength();
+ length = (matchLength == 0) ? (int) file.length() - offset : matchLength;
if (length < 0) {
length = 0;
Please sign in to comment.
Something went wrong with that request. Please try again.