Skip to content

Commit

Permalink
Feedback from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss committed May 22, 2024
1 parent 517c517 commit cca7693
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions magic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,10 @@ def what(file: os.PathLike | str | None, h: bytes | None) -> str:
imghdr source code: https://github.com/python/cpython/blob/3.12/Lib/imghdr.py
"""
if not h:
return from_file(file, False).split()[0].lower()
return from_file(file).split()[0].lower()

if isinstance(h, str):
bytes.fromhex(h)
h = bytes.fromhex(h)
ext = from_buffer(h).split()[0].lower()
return imghdr_exts.get(ext, ext)

Expand Down

0 comments on commit cca7693

Please sign in to comment.