mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-27 23:17:20 +01:00
Normalize instance paths before storing
This commit is contained in:
@@ -175,5 +175,17 @@ namespace TGServerService
|
||||
{
|
||||
return input.Replace("%", "%25").Replace("=", "%3d").Replace(";", "%3b").Replace("&", "%26").Replace("+", "%2b");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Normalizes different versions of a path <see cref="string"/>
|
||||
/// </summary>
|
||||
/// <param name="path">The path to normalize</param>
|
||||
/// <returns>The normalized path</returns>
|
||||
public static string NormalizePath(string path)
|
||||
{
|
||||
return Path.GetFullPath(new Uri(path).LocalPath)
|
||||
.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)
|
||||
.ToUpperInvariant();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user