MCPcopy Create free account
hub / github.com/ahupp/python-magic / _handle509Bug

Method _handle509Bug

magic/__init__.py:128–135  ·  view source on GitHub ↗
(self, e)

Source from the content-addressed store, hash-verified

126 return self._handle509Bug(e)
127
128 def _handle509Bug(self, e):
129 # libmagic 5.09 has a bug where it might fail to identify the
130 # mimetype of a file and returns null from magic_file (and
131 # likely _buffer), but also does not return an error message.
132 if e.message is None and (self.flags & MAGIC_MIME_TYPE):
133 return "application/octet-stream"
134 else:
135 raise e
136
137 def setparam(self, param, val):
138 return magic_setparam(self.cookie, param, val)

Callers 3

from_bufferMethod · 0.95
from_fileMethod · 0.95
from_descriptorMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected