@@ -290,7 +290,7 @@ func (h *handler) parsePortfolio(ctx context.Context, taskID task.ID, req *task.
290
290
// NOTE: This code could benefit from some concurrency, but I'm opting not to prematurely optimize.
291
291
var out []* task.ParsePortfolioResponseItem
292
292
for _ , p := range paths {
293
- lineCount , err := countLines (p )
293
+ lineCount , err := countCSVLines (p )
294
294
if err != nil {
295
295
return fmt .Errorf ("failed to count lines in file %q: %w" , p , err )
296
296
}
@@ -338,7 +338,7 @@ func (h *handler) parsePortfolio(ctx context.Context, taskID task.ID, req *task.
338
338
return nil
339
339
}
340
340
341
- func countLines (path string ) (int , error ) {
341
+ func countCSVLines (path string ) (int , error ) {
342
342
file , err := os .Open (path )
343
343
if err != nil {
344
344
return 0 , fmt .Errorf ("opening file failed: %w" , err )
@@ -352,7 +352,8 @@ func countLines(path string) (int, error) {
352
352
if err := scanner .Err (); err != nil {
353
353
return 0 , fmt .Errorf ("scanner.error returned: %w" , err )
354
354
}
355
- return lineCount , nil
355
+ // Subtract 1 for the header row
356
+ return lineCount - 1 , nil
356
357
}
357
358
358
359
func createReportReq () (* task.CreateReportRequest , error ) {
0 commit comments