Closed NVD-R closed 8 years ago
Can you please provide more information:
ruby -v
)FileMagic::VERSION
and FileMagic::MAGIC_VERSION
)`def self.verifier @verifier ||= ActiveSupport::MessageVerifier.new(Config[:verifier_key]) end
def self.text?(filename) begin fm = FileMagic.new(FileMagic::MAGIC_MIME) fm.file(filename) =~ /^text\// ensure fm.close end end
def self.binary?(filename) !text?(filename) end`
I cannot reproduce the error, but I'm almost certain this has nothing to do with ruby-filemagic, anyway. What does file --mime <your-long-file-name>
say? (You might need to install the file utility first.)
file: text/plain; charset=us-ascii
Can you try File.open(filename) { |f| fm.fd(f) }
instead of fm.file(filename)
?
i use that code but not work !!! does exist any limitation for filename length in FileMagic?
i use that code but not work !!!
Please post the exact error message and backtrace.
does exist any limitation for filename length in FileMagic?
No, there's not. My suspicion was that libmagic
had a limit; but seeing as the file
command worked, we can probably rule that out. [EDIT: The exception is raised here, so the error definitely originates from inside libmagic
.]
FileMagic::MAGIC_VERSION
and file -v
)
hi, i get error about filename to long and i search about it but i cant find any thing.can you help me about how can i handled this error?
FileMagic::FileMagicError: failed lookup: cannot open 'دریاچه_ی_چیتگر_یا_شهدای_خلیج_فارس_بزرگترین_دریاچه_ی_مصنوعی_ایران_است_که_در_شمال_غرب_شهر_تهران_واقع_شده_و_در_کنار_این_دریاچه_پارک_جنگلی_چیتگر_قرار_گرفته_است.docx' (File name too long)