Fix formatting and test

This commit is contained in:
Shadowghost
2026-08-30 22:29:36 +02:00
parent 420d44f638
commit 11adad0e67
3 changed files with 59 additions and 36 deletions
@@ -193,8 +193,13 @@ public static class FileSystemHelper
var fullParentPath = Path.TrimEndingDirectorySeparator(Path.GetFullPath(parentPath));
// Catches the remaining relative names, "." and "..", which are valid single segments.
return string.Equals(Path.GetDirectoryName(fullPath), fullParentPath, StringComparison.Ordinal)
? fullPath
: null;
if (!string.Equals(Path.GetDirectoryName(fullPath), fullParentPath, StringComparison.Ordinal))
{
return null;
}
// Windows strips trailing dots and spaces, so a name like "..." resolves to the parent directory itself
// and a name like "Movies." to a different child. Reject anything normalization did not leave intact.
return string.Equals(Path.GetFileName(fullPath), name, StringComparison.Ordinal) ? fullPath : null;
}
}