-
Notifications
You must be signed in to change notification settings - Fork 119
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
DecoderReader
does not respect with_decode_allow_trailing_bits
#236
Comments
Also, thanks for the crate. It is incredibly clean and impressive. |
Thanks for the bug report, and I'm glad you're enjoying the crate -- though apparently it's not clean enough to reach the goal of 0 bugs ;) It's troubling that the first legit incorrect behavior bugs that I can recall in a long time (this and #226) are both in DecoderReader. My primary aim in fixing both of those is not so much the fixes (which are pretty small) but rather greatly improving the test coverage in DecoderReader so that any future error handling corner cases are addressed. This also will be a big help in avoiding regressions with #231. |
Oh, what fun would this profession be without them? :) In all seriousness, the crate has worked flawlessly otherwise. I really appreciate the architecture too; it is incredibly configurable. Cool, let me know if I can help. I have a workaround in place. It's just a nice to have. |
OK, finally had some time to take a look at this. I don't think it's actually a bug --
The goal of with_decode_allow_trailing_bits is to handle erroneous output from buggy encoders. The trailing symbol I think ultimately the issue is that the line-oriented CLI stuff you're doing need newlines as framing, so to speak, but base64 doesn't know about newlines, or TCP headers, or any other similar concept -- it only does base64, so you'll need to remove your particular framing before decoding. |
Before you file an issue
The problem
DecoderReader
does not respectwith_decode_allow_trailing_bits
. Decoding input with a trailing newline results in the errorInvalid byte 10, offset 224.
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=6f1faeb41bee1e2b3bab8b5a510dd9f3
This is somewhat problematic with a CLI which can pipe back into itself. Adding a newline at the end of the output avoids the shell partial line indicator
%
.How I, the issue filer, am going to help solve it
The text was updated successfully, but these errors were encountered: