You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But it always fails, because this line in the magic file never matches:
>>&0 regex ['"]http://earth.google.com/kml Google KML document
It appears this is because RegexType is reading an entire line for every byte in the mutableOffset, causing the matching content to be skipped entirely. In other words, if mutableOffset.offset is ten, the code reads ten lines, rather than limiting its scope to ten bytes.
I found I was able to get KML files to be correctly detected by changing these lines in RegexType.java from this:
if (i < mutableOffset.offset) {
bytesOffset += line.length() + 1;
}
to this:
if (i < mutableOffset.offset) {
bytesOffset += line.length() + 1;
i += line.length();
}
The text was updated successfully, but these errors were encountered:
I wanted to use my local machine’s /usr/share/file/magic/kml to detect KML and KMZ files, with this code:
But it always fails, because this line in the magic file never matches:
It appears this is because RegexType is reading an entire line for every byte in the mutableOffset, causing the matching content to be skipped entirely. In other words, if mutableOffset.offset is ten, the code reads ten lines, rather than limiting its scope to ten bytes.
I found I was able to get KML files to be correctly detected by changing these lines in RegexType.java from this:
to this:
The text was updated successfully, but these errors were encountered: