Fix bad exception handling in cases of 0 CSVs in import ZIPs

This commit is contained in:
Kailash Nadh 2018-10-30 18:44:51 +05:30
parent 0163cf985f
commit 12182b3bc7
1 changed files with 2 additions and 0 deletions

View File

@ -80,6 +80,8 @@ func handleImportSubscribers(c echo.Context) error {
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError,
fmt.Sprintf("Error extracting ZIP file: %v", err))
} else if len(files) == 0 {
return echo.NewHTTPError(http.StatusBadRequest, "No CSV files found to import.")
}
go impSess.LoadCSV(dir+"/"+files[0], rune(r.Delim[0]))