From 08cc0c394bca5e4d1f1f82e4103307d2011e3e69 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sat, 1 Jan 2022 14:16:58 -0800 Subject: [PATCH] Sanitize filename after check (fixes #341) --- CHANGELIST.md | 1 + MPF.Library/InfoTool.cs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index f83a352b..0b98f1f8 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -14,6 +14,7 @@ - Add model for 2-layer ringcode guide - Add first attempt 2-layer ringcode guide - Add even more safety to clone +- Sanitize filename after check ### 2.2 (2021-12-30) - Fix Saturn header finding diff --git a/MPF.Library/InfoTool.cs b/MPF.Library/InfoTool.cs index 322e227f..23982392 100644 --- a/MPF.Library/InfoTool.cs +++ b/MPF.Library/InfoTool.cs @@ -51,9 +51,6 @@ namespace MPF.Library if (!system.MediaTypes().Contains(mediaType)) return null; - // Sanitize the output filename to strip off any potential extension - outputFilename = Path.GetFileNameWithoutExtension(outputFilename); - // Check that all of the relevant files are there (bool foundFiles, List missingFiles) = FoundAllFiles(outputDirectory, outputFilename, parameters, false); if (!foundFiles) @@ -62,6 +59,9 @@ namespace MPF.Library return null; } + // Sanitize the output filename to strip off any potential extension + outputFilename = Path.GetFileNameWithoutExtension(outputFilename); + // Create the SubmissionInfo object with all user-inputted values by default string combinedBase = Path.Combine(outputDirectory, outputFilename); SubmissionInfo info = new SubmissionInfo()