diff --git a/src/PIL/ImageShow.py b/src/PIL/ImageShow.py index 64c5b5924..b6aa02261 100644 --- a/src/PIL/ImageShow.py +++ b/src/PIL/ImageShow.py @@ -278,7 +278,7 @@ class CommandViewer(Viewer): command = options["command"] if not isinstance(command, str): raise TypeError(f"'command' must be 'str' not '{type(command)}'") - values = {"file": file, **options} + values = {"file": quote(file), **options} return command.format(values)