浏览代码

Add fast path to check for empty ignore files (#14782)

Bond-009 6 天之前
父节点
当前提交
deee04ae38
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      Emby.Server.Implementations/Library/DotIgnoreIgnoreRule.cs

+ 7 - 0
Emby.Server.Implementations/Library/DotIgnoreIgnoreRule.cs

@@ -50,6 +50,13 @@ public class DotIgnoreIgnoreRule : IResolverIgnoreRule
                 return false;
                 return false;
             }
             }
 
 
+            // Fast path in case the ignore files isn't a symlink and is empty
+            if ((dirIgnoreFile.Attributes & FileAttributes.ReparsePoint) == 0
+                && dirIgnoreFile.Length == 0)
+            {
+                return true;
+            }
+
             // ignore the directory only if the .ignore file is empty
             // ignore the directory only if the .ignore file is empty
             // evaluate individual files otherwise
             // evaluate individual files otherwise
             return string.IsNullOrWhiteSpace(GetFileContent(dirIgnoreFile));
             return string.IsNullOrWhiteSpace(GetFileContent(dirIgnoreFile));