Skip to content

Commit fc74679

Browse files
fix: Handle multiple \rs in delimiter new line search
1 parent abec84b commit fc74679

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

rfc822/scanner.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,13 @@ func indexOfNewLineAfterBoundary(data []byte) int {
5555
return 0
5656
}
5757

58-
if data[0] == '\n' {
59-
return 0
60-
} else if data[0] == '\r' && data[1] == '\n' {
61-
return 1
58+
//consume extra '\r's
59+
index := 0
60+
for ; index < dataLen && data[index] == '\r'; index++ {
61+
}
62+
63+
if data[index] == '\n' {
64+
return index
6265
}
6366

6467
return -1

0 commit comments

Comments
 (0)