aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Server.Integration.Tests/DotIgnoreLibraryRootTests.cs
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2026-11-20 07:14:33 -0500
committerGitHub <noreply@github.com>2026-11-20 07:14:33 -0500
commitbe19e7c7786f62e79ea79a671908986b73e47a61 (patch)
treee9941c3e4e95d0803b8b27be03b06094c3e520e2 /tests/Jellyfin.Server.Integration.Tests/DotIgnoreLibraryRootTests.cs
parent5c05f2af03642cada0f73a255289c433c88e557c (diff)
parent6561d58ad512bdc4dfd6dacf55a5b03b2a143623 (diff)
Merge pull request #18275 from Shadowghost/fix/17364-dotignore-library-root
Confine ignore file handling to library root
Diffstat (limited to 'tests/Jellyfin.Server.Integration.Tests/DotIgnoreLibraryRootTests.cs')
-rw-r--r--tests/Jellyfin.Server.Integration.Tests/DotIgnoreLibraryRootTests.cs55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/Jellyfin.Server.Integration.Tests/DotIgnoreLibraryRootTests.cs b/tests/Jellyfin.Server.Integration.Tests/DotIgnoreLibraryRootTests.cs
new file mode 100644
index 0000000000..2fd598e6b2
--- /dev/null
+++ b/tests/Jellyfin.Server.Integration.Tests/DotIgnoreLibraryRootTests.cs
@@ -0,0 +1,55 @@
+using System;
+using System.IO;
+using Emby.Server.Implementations.Library;
+using MediaBrowser.Controller;
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Library;
+using MediaBrowser.Model.IO;
+using Microsoft.Extensions.DependencyInjection;
+using Xunit;
+
+namespace Jellyfin.Server.Integration.Tests;
+
+public sealed class DotIgnoreLibraryRootTests : IClassFixture<JellyfinApplicationFactory>
+{
+ private readonly JellyfinApplicationFactory _factory;
+
+ public DotIgnoreLibraryRootTests(JellyfinApplicationFactory factory)
+ {
+ _factory = factory;
+ }
+
+ [Fact]
+ public void IgnoreFile_IgnoreFileAboveLibraryRoot_IsNotConsulted()
+ {
+ _ = _factory.CreateClient();
+
+ var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+ var libraryRoot = Path.Combine(tempDir, "Movies");
+ var movieDir = Path.Combine(libraryRoot, "Movie (2020)");
+ Directory.CreateDirectory(movieDir);
+ var libraryDir = Path.Combine(_factory.Services.GetRequiredService<IServerApplicationPaths>().DefaultUserViewsPath, "dotignore-root-test");
+ Directory.CreateDirectory(libraryDir);
+
+ try
+ {
+ File.WriteAllText(Path.Combine(tempDir, ".ignore"), string.Empty);
+ File.WriteAllText(Path.Combine(libraryDir, "Movies.mblink"), libraryRoot);
+
+ // The rule the resolver evaluates must be the singleton LibraryManager hands the roots to
+ _factory.Services.GetRequiredService<DotIgnoreIgnoreRule>().ClearDirectoryCache();
+ var fileInfo = new FileSystemMetadata
+ {
+ FullName = Path.Combine(movieDir, "Movie (2020).mkv"),
+ IsDirectory = false
+ };
+
+ Assert.False(_factory.Services.GetRequiredService<ILibraryManager>().IgnoreFile(fileInfo, new Folder { Path = movieDir }));
+ }
+ finally
+ {
+ Directory.Delete(libraryDir, true);
+ Directory.Delete(tempDir, true);
+ }
+ }
+}