mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-09-21 00:00:49 -04:00
fix filemagic: rewind file after mime type detection
This commit is contained in:
parent
f99abc38e2
commit
a03a66eb63
@ -14,9 +14,13 @@ module HTTPX
|
||||
def call(file, _)
|
||||
return nil if file.eof? # FileMagic returns "application/x-empty" for empty files
|
||||
|
||||
FileMagic.open(FileMagic::MAGIC_MIME_TYPE) do |filemagic|
|
||||
mime = FileMagic.open(FileMagic::MAGIC_MIME_TYPE) do |filemagic|
|
||||
filemagic.buffer(file.read(MAGIC_NUMBER))
|
||||
end
|
||||
|
||||
file.rewind
|
||||
|
||||
mime
|
||||
end
|
||||
elsif defined?(Marcel)
|
||||
def call(file, filename)
|
||||
|
Loading…
x
Reference in New Issue
Block a user