FIX: Add another method to check binary file (#15648)

This method looks for a NULL byte that is not usually contained in text
files. Follow up to 376799b1a4.
This commit is contained in:
Bianca Nenciu 2022-01-20 23:47:18 +02:00 committed by GitHub
parent a582c49601
commit 847c77de65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -169,7 +169,7 @@ module Onebox
else else
contents = URI.parse(self.raw_template(m)).open(read_timeout: timeout).read contents = URI.parse(self.raw_template(m)).open(read_timeout: timeout).read
if contents.encoding == Encoding::BINARY if contents.encoding == Encoding::BINARY || contents.bytes.include?(0)
@raw = nil @raw = nil
@binary = true @binary = true
return return