HaveIBeenPwned / EmailAddressExtractor

A project to rapidly extract all email addresses from any files in a given path
BSD 3-Clause "New" or "Revised" License
64 stars 23 forks source link

Fix failing test for a file with a blank line #31

Closed troyhunt closed 1 year ago

troyhunt commented 1 year ago

Just went to run this app against a new breach and it immediately returned zero records. It looks like if there's a blank line in the file the parsing bails out. I've added a failing test in https://github.com/HaveIBeenPwned/EmailAddressExtractor/commit/2c3231dc1a525c270cf07d3ed916ca47c0687a64.

GStefanowich commented 1 year ago

Looks like an oversight in the implementation of the FileStream, ReadLineAsync returns a string.Empty when the end of the file is reached. So when an empty line is reached in the middle of the file, it was assumed to be the end. Replaced with a call to check StreamReader.EndOfStream

Fixed in #32

troyhunt commented 1 year ago

Legend, perfect!