79534720

Date: 2025-03-25 20:00:14
Score: 1
Natty:
Report link

After .NET 5, System.IO.Path was made to be cross platform. I'd expect this to work everywhere.

private static bool IsSubPath(string parent, string child)
{
    string relPath = Path.GetRelativePath(parent, child);
    return !(Path.IsPathRooted(relPath) || relPath.StartsWith(".."));
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: will bodron