aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/IO
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller/IO')
-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;
}
}