-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
encoding/base64: seems to get confused by newlines #4779
Labels
Milestone
Comments
I investigated this issue and found it was a problem with the decoder reading an incomplete chunk of data if there is embedded whitespace. I was able to fix this by wrapping the io.Reader in NewDecoder with a reader which filters out whitespace. Does this sound like an ok approach? If so I'll create a review request. |
Created a changeset: https://golang.org/cl/7311069/ |
https://tools.ietf.org/html/rfc4648#section-3.1 says something about line-feeds in encoded data. I don't see this is an issue, i.e. the current decoder works as advertised. However if the golang-team wants to do something about this, should spaces also be skipped when decoding? |
The Decode() function works correctly. It is the Read function that is at fault. It calculates the amount of data to read "nn := len(p) / 3 * 4", but disregards any line-feeds it might see when doing the io.ReadAtLeast(). I'm not sure how to proceed, create a new reader that removed line-feeds (and other cruft) from the input? |
uploaded: https://golang.org/cl/7679043 |
This issue was closed by revision b4237b5. Status changed to Fixed. |
rsc
added
fixed
Suggested
Issues that may be good for new contributors looking for work to do.
labels
Mar 12, 2013
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
The text was updated successfully, but these errors were encountered: