Ignore .git and .github during checksum generate (#2990)

This commit is contained in:
Ice3man 2022-12-07 14:38:29 +05:30 committed by GitHub
parent 9418689eea
commit ccfa249f14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,6 +29,11 @@ func main() {
if err != nil || d.IsDir() {
return nil
}
pathIndex := path[strings.Index(path, "nuclei-templates/")+17:]
// Ignore items starting with dots
if strings.HasPrefix(pathIndex, ".") {
return nil
}
data, err := os.ReadFile(path)
if err != nil {
return nil
@ -37,7 +42,7 @@ func main() {
_, _ = io.Copy(h, bytes.NewReader(data))
hash := hex.EncodeToString(h.Sum(nil))
_, _ = file.WriteString(path[strings.Index(path, "nuclei-templates/")+17:])
_, _ = file.WriteString(pathIndex)
_, _ = file.WriteString(":")
_, _ = file.WriteString(hash)
_, _ = file.WriteString("\n")