Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

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

Kailash Nadh12182b3bc796
diff --git a/import.go b/import.go
index 89877bee..9125047e 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]))