mirror of
https://github.com/AssetRipper/AssetRipper.git
synced 2025-12-11 20:15:29 +01:00
Replace commas, brackets, and control characters with underscores (#1345)
* Sanitize filenames to exclude commas, brackets, and control characters * Add Missing Things
This commit is contained in:
parent
9f5c10c2b4
commit
5b87c961b6
@ -26,7 +26,8 @@ namespace AssetRipper.IO.Files.Utils
|
||||
{
|
||||
string invalidChars = new string(Path.GetInvalidFileNameChars().Except(new char[] { '\\', '/' }).ToArray());
|
||||
string escapedChars = Regex.Escape(invalidChars);
|
||||
return new Regex($"[{escapedChars}]");
|
||||
// Updated regex to include commas, square brackets, and ASCII control characters
|
||||
return new Regex($"[{escapedChars},\\[\\]\\x00-\\x1F]");
|
||||
}
|
||||
|
||||
public static string GetRelativePath(string filePath, string folder)
|
||||
|
||||
@ -90,7 +90,8 @@ namespace AssetRipper.IO.Files.Utils
|
||||
{
|
||||
string invalidChars = GetInvalidFileNameChars();
|
||||
string escapedChars = Regex.Escape(invalidChars);
|
||||
return new Regex($"[{escapedChars}]");
|
||||
// Updated regex to include commas, square brackets, and ASCII control characters
|
||||
return new Regex($"[{escapedChars},\\[\\]\\x00-\\x1F]");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user