Skip to content
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

fix fetching binary files such as images #504

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nickurban
Copy link

@nickurban nickurban commented Jul 25, 2024

Hello, when I fetch binary files such as images create by code_interpreter, I get a parsing error.

I determined that this is because response.is_a?(String) returns true for binary files such as png.

This PR fixes the parsing error, but I suspect there may be a better way to fix it.

For example, if someone was using non-utf-8 string encoding, this could break.

May need more investigation?

All Submissions:

  • [*] Have you followed the guidelines in our Contributing document?
  • [*] Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • [*] Have you added an explanation of what your changes do and why you'd like us to include them?

@alexrudall
Copy link
Owner

alexrudall commented Oct 10, 2024

Thanks, @nickurban - apologies for the delay in review. What about instead adding rescue JSON::ParserError?

It would be great to have a simple spec for this also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants