From 18df9894204048c670cbf934024b0530215af598 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Wed, 17 Aug 2022 23:00:28 +0200 Subject: [PATCH] Check folder names for '.' and '..' --- Penumbra/Mods/Mod.Creation.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Penumbra/Mods/Mod.Creation.cs b/Penumbra/Mods/Mod.Creation.cs index abe11f25..d9c64cc1 100644 --- a/Penumbra/Mods/Mod.Creation.cs +++ b/Penumbra/Mods/Mod.Creation.cs @@ -97,7 +97,7 @@ public partial class Mod .Select( f => ( Utf8GamePath.FromFile( f, optionFolder, out var gamePath, true ), gamePath, new FullPath( f ) ) ) .Where( t => t.Item1 ); - var mod = new SubMod(null!) // Mod is irrelevant here, only used for saving. + var mod = new SubMod( null! ) // Mod is irrelevant here, only used for saving. { Name = option.Name, }; @@ -112,7 +112,7 @@ public partial class Mod // Create an empty sub mod for single groups with None options. internal static ISubMod CreateEmptySubMod( string name ) - => new SubMod(null! ) // Mod is irrelevant here, only used for saving. + => new SubMod( null! ) // Mod is irrelevant here, only used for saving. { Name = name, }; @@ -144,6 +144,16 @@ public partial class Mod // and the path must obviously be valid itself. public static string ReplaceBadXivSymbols( string s, string replacement = "_" ) { + if( s == "." ) + { + return replacement; + } + + if( s == ".." ) + { + return replacement + replacement; + } + StringBuilder sb = new(s.Length); foreach( var c in s ) {