Skip to content

Commit

Permalink
Merge pull request #31 from IowaComputerGurus/feature/chart-by-action
Browse files Browse the repository at this point in the history
Fixes #25 by validating 0 length files
  • Loading branch information
mitchelsellers authored Jan 10, 2024
2 parents 0d43ca5 + 2f96015 commit 136b58f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/GitHubCostVisualizer.Web/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public IActionResult Report(HomeViewModel data)
using (var csvData = new CsvReader(reader, CultureInfo.InvariantCulture))
{
var rawReport = csvData.GetRecords<GithubUsageEntry>().ToList();
if (rawReport.Count == 0)
{
ModelState.AddModelError(nameof(data.UploadFile), "The uploaded file did not contain any records, please try with a different file.");
return View(nameof(Index), data);
}
var model = _processor.ProcessUsageReport(rawReport);
return View(model);
}
Expand Down

0 comments on commit 136b58f

Please sign in to comment.