From 11adad0e67f9487536ed8e727955645c4dee4244 Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Sun, 30 Aug 2026 22:29:36 +0200 Subject: Fix formatting and test --- MediaBrowser.Controller/IO/FileSystemHelper.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'MediaBrowser.Controller/IO/FileSystemHelper.cs') diff --git a/MediaBrowser.Controller/IO/FileSystemHelper.cs b/MediaBrowser.Controller/IO/FileSystemHelper.cs index f636258191..b2d2273cbe 100644 --- a/MediaBrowser.Controller/IO/FileSystemHelper.cs +++ b/MediaBrowser.Controller/IO/FileSystemHelper.cs @@ -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; } } -- cgit v1.2.3