-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tolerate (incorrect) folding whitespace used in base64 encoded body content. #152
Tolerate (incorrect) folding whitespace used in base64 encoded body content. #152
Conversation
Any thoughts on accepting this PR? Fixes a problem we see with real world mail, yes it technically shouldn't be happening, but as with most things email there's always something writing mail that does so badly. Always. |
Can we maybe replace |
It's actually based on the code from Here's the original code from the standard library: type newlineFilteringReader struct {
wrapped io.Reader
}
func (r *newlineFilteringReader) Read(p []byte) (int, error) {
n, err := r.wrapped.Read(p)
for n > 0 {
offset := 0
for i, b := range p[:n] {
if b != '\r' && b != '\n' {
if i != offset {
p[offset] = b
}
offset++
}
}
if offset > 0 {
return offset, err
}
// Previous buffer entirely whitespace, read again
n, err = r.wrapped.Read(p)
}
return n, err
} |
Done - yes it is a lot more simple, thanks for the suggestion! |
Hm but the wrapping is done internally by the standard library anyways right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks! |
Yup 🙄 clearly I was just satisfied with it working and then just went to live in fantasy land for a while! |
Fixes #151