mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-17 18:54:46 +03:00
Ensure filename is a string
This commit is contained in:
parent
d788682afe
commit
9c5bad6f0a
|
@ -2189,7 +2189,7 @@ class Image:
|
|||
filename = str(fp)
|
||||
open_fp = True
|
||||
elif isPath(fp):
|
||||
filename = fp
|
||||
filename = os.fsdecode(fp)
|
||||
open_fp = True
|
||||
elif fp == sys.stdout:
|
||||
try:
|
||||
|
@ -2209,7 +2209,7 @@ class Image:
|
|||
|
||||
preinit()
|
||||
|
||||
ext = os.fsdecode(os.path.splitext(filename)[1].lower())
|
||||
ext = os.path.splitext(filename)[1].lower()
|
||||
|
||||
if not format:
|
||||
if ext not in EXTENSION:
|
||||
|
|
|
@ -317,7 +317,7 @@ def _accept(prefix):
|
|||
|
||||
|
||||
def _save(im, fp, filename):
|
||||
if os.fsdecode(os.path.splitext(filename)[1]) == ".j2k":
|
||||
if filename.endswith(".j2k"):
|
||||
kind = "j2k"
|
||||
else:
|
||||
kind = "jp2"
|
||||
|
|
Loading…
Reference in New Issue
Block a user