diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2026-08-30 22:29:36 +0200 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2026-08-30 22:29:36 +0200 |
| commit | 11adad0e67f9487536ed8e727955645c4dee4244 (patch) | |
| tree | 6226761d735d99cd3114eb781177cd2435d0a9bf /MediaBrowser.Controller/IO/FileSystemHelper.cs | |
| parent | 420d44f638c44b942b43303c3165c2e8795b9020 (diff) | |
Fix formatting and test
Diffstat (limited to 'MediaBrowser.Controller/IO/FileSystemHelper.cs')
| -rw-r--r-- | MediaBrowser.Controller/IO/FileSystemHelper.cs | 11 |
1 files changed, 8 insertions, 3 deletions
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; } } |
