fix header detection

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2025-11-03 13:31:35 +01:00
parent b8dba7cfd4
commit a3daa41fa0

View File

@@ -6,7 +6,6 @@ import (
"fmt" "fmt"
"io" "io"
"os" "os"
"slices"
"strings" "strings"
"github.com/anotherhadi/eleakxir/leak-utils/settings" "github.com/anotherhadi/eleakxir/leak-utils/settings"
@@ -97,11 +96,10 @@ func csvHasHeader(inputFile, delimiter string) (hasHeader bool, err error) {
} }
knownHeaders := []string{"email", "password", "username", "phone", "lastname", "firstname", "mail", "addresse", "nom", "id"} knownHeaders := []string{"email", "password", "username", "phone", "lastname", "firstname", "mail", "addresse", "nom", "id"}
for _, knownHeader := range knownHeaders { for _, knownHeader := range knownHeaders {
if slices.Contains(firstRow, knownHeader) { for _, col := range firstRow {
return true, nil if strings.HasPrefix(col, "_"+knownHeader) || col == knownHeader {
} return true, nil
if slices.Contains(firstRow, "_"+knownHeader) { }
return true, nil
} }
} }
return false, nil return false, nil