Add logic to skip .slinkignore files during URL collection in fsurls.go

Enhance the CollectURLs and CollectURLsProgress functions to ensure that any .slinkignore files are excluded from scanning. This change improves the handling of ignored paths and maintains consistency in the ignore logic.
This commit is contained in:
Luke Hagar
2025-09-16 19:55:54 +00:00
parent 3427464985
commit f3acb36e36

View File

@@ -108,6 +108,12 @@ func CollectURLs(rootPath string, globs []string, respectGitignore bool) (map[st
}
return nil
}
// Always skip any .slinkignore file from scanning
if filepath.Base(path) == ".slinkignore" || rel == ".slinkignore" || strings.HasSuffix(rel, "/.slinkignore") {
return nil
}
if (ign != nil && ign.MatchesPath(rel)) || (slPathIgnore != nil && slPathIgnore.MatchesPath(rel)) {
return nil
}
@@ -249,6 +255,10 @@ func CollectURLsProgress(rootPath string, globs []string, respectGitignore bool,
}
return nil
}
// Always skip any .slinkignore file from scanning
if filepath.Base(path) == ".slinkignore" || rel == ".slinkignore" || strings.HasSuffix(rel, "/.slinkignore") {
return nil
}
if (ign != nil && ign.MatchesPath(rel)) || (slPathIgnore != nil && slPathIgnore.MatchesPath(rel)) {
return nil
}