Skip hidden directories and .ignore paths in library monitoring (#16029)

This commit is contained in:
theguymadmax 2026-01-16 20:45:19 -05:00 committed by GitHub
parent 8433b6d8a4
commit 2cb7fb52d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 2 deletions

View file

@ -352,6 +352,12 @@ namespace Emby.Server.Implementations.IO
return; return;
} }
var fileInfo = _fileSystem.GetFileSystemInfo(path);
if (DotIgnoreIgnoreRule.IsIgnored(fileInfo, null))
{
return;
}
// Ignore certain files, If the parent of an ignored path has a change event, ignore that too // Ignore certain files, If the parent of an ignored path has a change event, ignore that too
foreach (var i in _tempIgnoredPaths.Keys) foreach (var i in _tempIgnoredPaths.Keys)
{ {

View file

@ -83,6 +83,7 @@ namespace Emby.Server.Implementations.Library
// Unix hidden files // Unix hidden files
"**/.*", "**/.*",
"**/.*/**",
// Mac - if you ever remove the above. // Mac - if you ever remove the above.
// "**/._*", // "**/._*",

View file

@ -19,7 +19,7 @@ namespace Jellyfin.Server.Implementations.Tests.Library
[InlineData("/media/movies/#recycle", true)] [InlineData("/media/movies/#recycle", true)]
[InlineData("thumbs.db", true)] [InlineData("thumbs.db", true)]
[InlineData(@"C:\media\movies\movie.avi", false)] [InlineData(@"C:\media\movies\movie.avi", false)]
[InlineData("/media/.hiddendir/file.mp4", false)] [InlineData("/media/.hiddendir/file.mp4", true)]
[InlineData("/media/dir/.hiddenfile.mp4", true)] [InlineData("/media/dir/.hiddenfile.mp4", true)]
[InlineData("/media/dir/._macjunk.mp4", true)] [InlineData("/media/dir/._macjunk.mp4", true)]
[InlineData("/volume1/video/Series/@eaDir", true)] [InlineData("/volume1/video/Series/@eaDir", true)]
@ -32,7 +32,7 @@ namespace Jellyfin.Server.Implementations.Tests.Library
[InlineData("/media/music/Foo B.A.R", false)] [InlineData("/media/music/Foo B.A.R", false)]
[InlineData("/media/music/Foo B.A.R.", false)] [InlineData("/media/music/Foo B.A.R.", false)]
[InlineData("/movies/.zfs/snapshot/AutoM-2023-09", true)] [InlineData("/movies/.zfs/snapshot/AutoM-2023-09", true)]
public void PathIgnored(string path, bool expected) public void PathIgnored(string path, bool expected)
{ {
Assert.Equal(expected, IgnorePatterns.ShouldIgnore(path)); Assert.Equal(expected, IgnorePatterns.ShouldIgnore(path));
} }