From e01ebf8d8e921ab7d68667cfda2e345d5104ea2d Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sat, 9 Apr 2022 13:21:31 -0700 Subject: [PATCH] Explicitly sanitize '?' from path --- CHANGELIST.md | 1 + MPF.Library/InfoTool.cs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index 3fa8d806..0d9104e4 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -42,6 +42,7 @@ - Report dictionary to InfoTool - Even even stricter copy protection output - Disable PVD creation for Aaru +- Explicitly sanitize '?' from path ### 2.3 (2022-02-05) - Start overhauling Redump information pulling, again diff --git a/MPF.Library/InfoTool.cs b/MPF.Library/InfoTool.cs index 1f7d29cf..eca9961d 100644 --- a/MPF.Library/InfoTool.cs +++ b/MPF.Library/InfoTool.cs @@ -1177,9 +1177,13 @@ namespace MPF.Library .Replace(':', '_', 0, directory.LastIndexOf(':') == -1 ? 0 : directory.LastIndexOf(':')) .ToString(); - // Sanitize everything else + // Sanitize the directory path + directory = directory.Replace('?', '_'); foreach (char c in Path.GetInvalidPathChars()) directory = directory.Replace(c, '_'); + + // Sanitize the filename + filename = filename.Replace('?', '_'); foreach (char c in Path.GetInvalidFileNameChars()) filename = filename.Replace(c, '_');