From 06f83a7c2f8931567f303e9e855028d528596733 Mon Sep 17 00:00:00 2001 From: Christian Arty <40256027+christianarty@users.noreply.github.com> Date: Tue, 11 Jun 2024 09:42:28 -0400 Subject: [PATCH 1/3] remove `pillow` and replace with `filetype` --- constraints.txt | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/constraints.txt b/constraints.txt index 9d59e9a7e..c1b22b7fb 100644 --- a/constraints.txt +++ b/constraints.txt @@ -105,7 +105,7 @@ parso==0.8.3 # via jedi pickleshare==0.7.5 # via ipython -pillow==10.2.0 +filetype==1.2.0 # via jira (setup.cfg) pluggy==1.4.0 # via pytest diff --git a/pyproject.toml b/pyproject.toml index 133e1bf3d..831e6b3ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ keywords = ["api", "atlassian", "jira", "rest", "web"] dependencies = [ "defusedxml", "packaging", - "Pillow>=2.1.0", + "filetype>=1.2.0", "requests-oauthlib>=1.1.0", "requests>=2.10.0", "requests_toolbelt", From 77bc965dc8e45ef15738bb6254892416c0373445 Mon Sep 17 00:00:00 2001 From: Christian Arty <40256027+christianarty@users.noreply.github.com> Date: Tue, 11 Jun 2024 09:42:52 -0400 Subject: [PATCH 2/3] replace pillow impl with filetype --- jira/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jira/client.py b/jira/client.py index ff311bcd6..dd5018c58 100644 --- a/jira/client.py +++ b/jira/client.py @@ -41,8 +41,8 @@ from urllib.parse import parse_qs, quote, urlparse import requests +from filetype import guess_mime from packaging.version import parse as parse_version -from PIL import Image from requests import Response from requests.auth import AuthBase from requests.structures import CaseInsensitiveDict @@ -4425,8 +4425,8 @@ def _get_mime_type(self, buff: bytes) -> str | None: if self._magic is not None: return self._magic.id_buffer(buff) try: - return mimetypes.guess_type("f." + Image.open(buff).format)[0] - except (OSError, TypeError): + return guess_mime(buff) + except TypeError: self.log.warning( "Couldn't detect content type of avatar image" ". Specify the 'contentType' parameter explicitly." From c68dfba5cd8dd7ee364d84089b2a1cb4d57af6bc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 11 Jun 2024 13:47:56 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- jira/client.py | 1 - 1 file changed, 1 deletion(-) diff --git a/jira/client.py b/jira/client.py index dd5018c58..4f3f5aee1 100644 --- a/jira/client.py +++ b/jira/client.py @@ -14,7 +14,6 @@ import hashlib import json import logging as _logging -import mimetypes import os import re import sys