-
-
Notifications
You must be signed in to change notification settings - Fork 7k
[Ruby] Fix Content-Transfer-Encoding binary unpacking #19132
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
Conversation
please update the samples (step 3) so that CI can verify the fix |
@wing328 I've gone through this a few times, and nothing changes; but it could be because some of the threads crash out on the second command:
|
Oh, looks like I can run just the ruby ones. |
lgtm. let's give it a try thanks for the fix |
I think this needs to be updated to be content = content.unpack('m').join if response.headers['Content-Transfer-Encoding'] == 'binary' && !content.starts_with?('%PDF-') |
@sirwolfgang I believe your patch actually broke things further rather than fix them.
What you've added is doing things backwards - when the header is set to To make this work correctly, the actual conditional might be: content = content.unpack('m').join if response.headers['Content-Transfer-Encoding'] == 'base64' but I'm not sure if this is not already handled by Faraday and based on your description I believe this might not have been the original cause of your problem. |
Based on my findings attempting to download PDFs with a downstream gem, I discovered that binary transferred data is never being unpacked into it's native format. This renders the results malformed. mxenabled/mx-platform-ruby#90
This PR adds a patch that simplifies the flow control of the
deserialize
method, while updating it to properly deserialize content from binary transfer encoding.I have a patch of this running downstream in production.
Ruby Committee: @cliffano @zlx @autopp
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master
(upcoming 7.6.0 minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)