aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/IO/FileSystemHelper.cs
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2026-08-30 17:52:39 -0400
committerGitHub <noreply@github.com>2026-08-30 17:52:39 -0400
commit7d6633ad1e9b4b69be87b2ac601fcadbacc37376 (patch)
tree6226761d735d99cd3114eb781177cd2435d0a9bf /MediaBrowser.Controller/IO/FileSystemHelper.cs
parent420d44f638c44b942b43303c3165c2e8795b9020 (diff)
parent11adad0e67f9487536ed8e727955645c4dee4244 (diff)
Merge pull request #17744 from Shadowghost/fix-masterHEADmaster
Fix formatting and test
Diffstat (limited to 'MediaBrowser.Controller/IO/FileSystemHelper.cs')
-rw-r--r--MediaBrowser.Controller/IO/FileSystemHelper.cs11
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;
}
}