Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace imghdr by puremagic #19074

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/galaxy/dependencies/pinned-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ propcache==0.2.0 ; python_version >= "3.8" and python_version < "3.13"
prov==1.5.1 ; python_version >= "3.8" and python_version < "3.13"
psutil==6.1.0 ; python_version >= "3.8" and python_version < "3.13"
pulsar-galaxy-lib==0.15.6 ; python_version >= "3.8" and python_version < "3.13"
puremagic==1.28 ; python_version >= "3.8" and python_version < "3.13"
pycparser==2.22 ; python_version >= "3.8" and python_version < "3.13"
pycryptodome==3.21.0 ; python_version >= "3.8" and python_version < "3.13"
pydantic-core==2.23.4 ; python_version >= "3.8" and python_version < "3.13"
Expand Down
5 changes: 3 additions & 2 deletions lib/galaxy/util/image_util.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""Provides utilities for working with image files."""

import imghdr
import logging
from typing import (
List,
Optional,
)

import puremagic

try:
from PIL import Image
except ImportError:
Expand All @@ -26,7 +27,7 @@ def image_type(filename: str) -> Optional[str]:
# exception we expect to happen frequently, so we're not logging
pass
if not fmt:
fmt = imghdr.what(filename)
fmt = puremagic.what(filename)
if fmt:
return fmt.upper()
else:
Expand Down
Loading