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"
"io"
"os"
"slices"
"strings"
"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"}
for _, knownHeader := range knownHeaders {
if slices.Contains(firstRow, knownHeader) {
for _, col := range firstRow {
if strings.HasPrefix(col, "_"+knownHeader) || col == knownHeader {
return true, nil
}
if slices.Contains(firstRow, "_"+knownHeader) {
return true, nil
}
}
return false, nil