mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-18 03:04:45 +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)
|
filename = str(fp)
|
||||||
open_fp = True
|
open_fp = True
|
||||||
elif isPath(fp):
|
elif isPath(fp):
|
||||||
filename = fp
|
filename = os.fsdecode(fp)
|
||||||
open_fp = True
|
open_fp = True
|
||||||
elif fp == sys.stdout:
|
elif fp == sys.stdout:
|
||||||
try:
|
try:
|
||||||
|
@ -2209,7 +2209,7 @@ class Image:
|
||||||
|
|
||||||
preinit()
|
preinit()
|
||||||
|
|
||||||
ext = os.fsdecode(os.path.splitext(filename)[1].lower())
|
ext = os.path.splitext(filename)[1].lower()
|
||||||
|
|
||||||
if not format:
|
if not format:
|
||||||
if ext not in EXTENSION:
|
if ext not in EXTENSION:
|
||||||
|
|
|
@ -317,7 +317,7 @@ def _accept(prefix):
|
||||||
|
|
||||||
|
|
||||||
def _save(im, fp, filename):
|
def _save(im, fp, filename):
|
||||||
if os.fsdecode(os.path.splitext(filename)[1]) == ".j2k":
|
if filename.endswith(".j2k"):
|
||||||
kind = "j2k"
|
kind = "j2k"
|
||||||
else:
|
else:
|
||||||
kind = "jp2"
|
kind = "jp2"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user