mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 11:28:18 +00:00
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 376799b1a49306be500be3419a327af8b03819ec.
This commit is contained in:
parent
a582c49601
commit
847c77de65
@ -169,7 +169,7 @@ module Onebox
|
||||
else
|
||||
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
|
||||
@binary = true
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user