ericberman / MyFlightbookWeb

The website and service for MyFlightbook
49 stars 18 forks source link

Crash in preview of flights to import #1315

Closed ericberman closed 2 months ago

ericberman commented 2 months ago

Report below; I think the issue is that initfrombytes was incrementing the row count for every row, but if the spreadsheet has a ton of blank lines, then the indicated row of the error could be higher than the number of elements in the flights table.


Request = https://myflightbook.com/logbook/mvc/Import/PreviewResults User = Language=en-US, en;q=0.9 By: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 12.12.182.72 12.12.182.72

Referrer requested: https://myflightbook.com/logbook/mvc/import Last page requested by user = https:myflightbook.com/logbook/mvc/import

Message: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Source: mscorlib Target site Void ThrowArgumentOutOfRangeException(System.ExceptionArgument, System.ExceptionResource)

Stack trace: at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) at System.Collections.Generic.List`1.get_Item(Int32 index) at ASP._Page_Areas_mvc_Views_import__importFlightsPreview_cshtml.Execute() in C:\MyFlightbook\logbook\Areas\mvc\Views\import_importFlightsPreview.cshtml: line 21