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

Skip to content

Commit 1e19aa8

Browse files
authored
Merge pull request #18523 from QuLogic/ps-metadata
Don't leak file paths into PostScript metadata
2 parents 67aa2a1 + 89fefdf commit 1e19aa8

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

lib/matplotlib/backends/backend_ps.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,11 +797,12 @@ 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",
804-
f"matplotlib version {mpl.__version__}, http://matplotlib.org/")
805+
f"Matplotlib v{mpl.__version__}, https://matplotlib.org/")
805806
# See https://reproducible-builds.org/specs/source-date-epoch/
806807
source_date_epoch = os.getenv("SOURCE_DATE_EPOCH")
807808
dsc_comments["CreationDate"] = (

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

Lines changed: 3 additions & 3 deletions
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: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)