Explicitly sanitize '?' from path

This commit is contained in:
Matt Nadareski
2022-04-09 13:21:31 -07:00
parent e92bcd378c
commit e01ebf8d8e
2 changed files with 6 additions and 1 deletions

View File

@@ -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

View File

@@ -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, '_');