Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a95f17

Browse files
committed
Don't leak full path into PostScript Title.
1 parent 4148262 commit 4a95f17

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

lib/matplotlib/backends/backend_ps.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,8 +797,9 @@ def _print_ps(
797797

798798
dsc_comments = {}
799799
if isinstance(outfile, (str, os.PathLike)):
800+
filename = pathlib.Path(outfile).name
800801
dsc_comments["Title"] = \
801-
os.fspath(outfile).encode("ascii", "replace").decode("ascii")
802+
filename.encode("ascii", "replace").decode("ascii")
802803
dsc_comments["Creator"] = (metadata or {}).get(
803804
"Creator",
804805
f"matplotlib version {mpl.__version__}, http://matplotlib.org/")

lib/matplotlib/tests/baseline_images/test_backend_ps/useafm.eps

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/matplotlib/tests/baseline_images/test_path/nan_path.eps

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)