Normalize instance paths before storing

This commit is contained in:
Cyberboss
2017-11-07 15:53:45 -05:00
parent 5fa47a291e
commit 8f8b1bfa5a
3 changed files with 15 additions and 1 deletions
+12
View File
@@ -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();
}
}
}