From 12182b3bc79614f01edc7877ca8f38fe7a7fcc1d Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Tue, 30 Oct 2018 18:44:51 +0530 Subject: [PATCH] Fix bad exception handling in cases of 0 CSVs in import ZIPs --- import.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/import.go b/import.go index 89877be..9125047 100644 --- a/import.go +++ b/import.go @@ -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]))