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 pillow with filetype #1867

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 1 addition & 1 deletion constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import hashlib
import json
import logging as _logging
import mimetypes
import os
import re
import sys
Expand All @@ -41,8 +40,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
Expand Down Expand Up @@ -4425,8 +4424,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."
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading