Simple check for empty columns in CSV import to prevent crashes

pull/1069/merge
Jordan Wright 2018-06-09 14:20:14 -05:00
parent 35a8f13990
commit 240a0d3ad2
1 changed files with 4 additions and 4 deletions

View File

@ -91,20 +91,20 @@ func ParseCSV(r *http.Request) ([]models.Target, error) {
if err == io.EOF {
break
}
if fi != -1 {
if fi != -1 && len(record) > fi {
fn = record[fi]
}
if li != -1 {
if li != -1 && len(record) > li {
ln = record[li]
}
if ei != -1 {
if ei != -1 && len(record) > ei {
csvEmail, err := mail.ParseAddress(record[ei])
if err != nil {
continue
}
ea = csvEmail.Address
}
if pi != -1 {
if pi != -1 && len(record) > pi {
ps = record[pi]
}
t := models.Target{