aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Controller.Tests/IO
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Jellyfin.Controller.Tests/IO')
-rw-r--r--tests/Jellyfin.Controller.Tests/IO/FileSystemHelperTests.cs20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/Jellyfin.Controller.Tests/IO/FileSystemHelperTests.cs b/tests/Jellyfin.Controller.Tests/IO/FileSystemHelperTests.cs
index 4c7addd164..b4ec2f1903 100644
--- a/tests/Jellyfin.Controller.Tests/IO/FileSystemHelperTests.cs
+++ b/tests/Jellyfin.Controller.Tests/IO/FileSystemHelperTests.cs
@@ -13,7 +13,6 @@ public class FileSystemHelperTests
[InlineData("Movies")]
[InlineData("My Movies")]
[InlineData("..2")]
- [InlineData("...")]
[InlineData("a.b")]
public void GetChildPath_ValidName_ReturnsPathInsideParent(string name)
{
@@ -50,6 +49,25 @@ public class FileSystemHelperTests
Assert.True(path is null || string.Equals(Path.GetDirectoryName(path), _parentPath, StringComparison.Ordinal));
}
+ [Theory]
+ [InlineData("...")]
+ [InlineData("Movies.")]
+ [InlineData("Movies ")]
+ public void GetChildPath_TrailingDotOrSpace_RejectedOnWindows(string name)
+ {
+ var path = FileSystemHelper.GetChildPath(_parentPath, name);
+
+ if (OperatingSystem.IsWindows())
+ {
+ // Windows trims trailing dots and spaces, so the name would resolve to the parent or to a different child.
+ Assert.Null(path);
+ }
+ else
+ {
+ Assert.Equal(Path.Combine(_parentPath, name), path);
+ }
+ }
+
[Fact]
public void GetChildPath_ParentWithTrailingSeparator_ReturnsPathInsideParent()
{