Skip to content

Commit

Permalink
if libmagic doesn't say 'text' anywhere, it's probably binary
Browse files Browse the repository at this point in the history
  • Loading branch information
brianmario committed Sep 8, 2011
1 parent dc9d3b0 commit e88d31a
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions ext/charlock_holmes/encoding_detector.c
Expand Up @@ -54,11 +54,7 @@ static int detect_binary_content(charlock_detector_t *detector, VALUE rb_str) {
binary_result = magic_buffer(detector->magic, RSTRING_PTR(rb_str), RSTRING_LEN(rb_str));

if (binary_result) {
if (strstr(binary_result, "library") ||
strstr(binary_result, "bundle") ||
strstr(binary_result, "archive") ||
(!strstr(binary_result, "text") && strstr(binary_result, "executable")) ||
strstr(binary_result, "data"))
if (!strstr(binary_result, "text"))
return 1;
} else {
rb_raise(rb_eStandardError, magic_error(detector->magic));
Expand Down

0 comments on commit e88d31a

Please sign in to comment.