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 broken encoding (fixes #920) #1118

Merged
merged 8 commits into from
Nov 14, 2022

Conversation

lparry
Copy link
Contributor

@lparry lparry commented Apr 28, 2019

We have run into problems where using client.content() returns an 8-bit ascii string, while the source file is UTF-8, as is reaffirmed by the charset within the content type header.

This PR checks for that charset header, and when found calls #force_encoding on the ascii string to make the UTF-8 characters be interpreted correctly.

I had to do some VCR cassette doctoring in order to reference the new fixture as though it was already in the canonical repo and already on master. Hopefully I didn't mess it up in some unforeseen way

Should fix #920

(it seems like it's not broken for documents where it wouldn't matter if
it was broken)
I'm sure this doesn't completely fix this broken behaviour, but it fixes
the flavour of it that bit me.
@lparry lparry force-pushed the lparry/fix-broken-encoding branch from d92dbd9 to f6ffb3c Compare April 28, 2019 23:24
@lparry
Copy link
Contributor Author

lparry commented May 13, 2019

Please let me know if there's anything I can do to help get this merged. Thanks!

@daniel-beard
Copy link

Am also hitting this issue, is there any path to merging this PR?

@lparry
Copy link
Contributor Author

lparry commented Oct 23, 2019

:tumbleweeds:

@CarlaBehan1212
Copy link

Thanks for your help with this matter is greatly appreciated and I will get it from the working class people who have been trying to get in touch with me and well-being.

@eneko
Copy link

eneko commented Dec 12, 2019

Please fix. We've been having this issue for a long time, as Danger relies on this library for diffing pull requests.

dzenbot added a commit to dzenbot/DZNEmptyDataSet that referenced this pull request Dec 31, 2019
dzenbot added a commit to dzenbot/DZNEmptyDataSet that referenced this pull request Jan 1, 2020
dzenbot added a commit to dzenbot/DZNEmptyDataSet that referenced this pull request Jan 1, 2020
* Updating to FBSnapshotTestCase's latest 6.2.0 & updating snapshot tests accordingly for Xcode 11.3

* Disabling Danger for now, since it's crashing lately due to octokit. Should get back up once octokit/octokit.rb#1118 is merged

* Updating the simulator env and Xcode version

* scheme config
@lparry
Copy link
Contributor Author

lparry commented Feb 7, 2020

Hey @hmharvey @tarebyte, I see two releases have happened since this was opened, but this fix has not been included.

Can you please let me know what needs to happen to make this PR acceptable to be merged, so that our team can stop using our own fork?

@tarebyte
Copy link
Member

tarebyte commented Feb 12, 2020

@lparry apologies for the delay. After conferring with a few colleagues to verify my initial reaction, we've come to the conclusion that this is a breaking change. We're working toward the release of v5 but I think it'll be a while before we get there with the generated client.

I'm still not entirely sure why this is always returning 8-bit ascii string so I will probably need to track that down. Perhaps it's something to do with the Sawyer/Faraday combo.

It's an issue with the adapter that is used with Faraday lostisland/faraday#139. Some adapters handle it better than others.

In the mean time we can still work together to make this change more robust for all of our use cases. Here's probably what we'll need to do:

  • Reach out to GitHub Support and find out all of the various types of formats that are sent back.
  • Add tests covering all of those cases (and solve the Base64 case as you mentioned)
  • Add a warning to let folks know that the response format will be changing in a future version.

If this sounds agreeable please let me know @lparry, and again thanks for being so patient.

@tarebyte
Copy link
Member

@lparry thinking about this more, this sounds like a good middleware that we could allow users to opt into. I don't think that would be a breaking change.

@titanium-cranium
Copy link

Hi @tarebyte: Unfortunately, @lparry has recently moved on to another company and I'm now picking up the ball to determine the status of the proposed fix. Any progress?

@tarebyte
Copy link
Member

tarebyte commented May 6, 2020

I'm now picking up the ball to determine the status of the proposed fix. Any progress?

I haven't at this point. I might try and look at it in the next few weeks. It's GitHub Satellite this week and I'm on vacation the next.

@titanium-cranium
Copy link

I haven't at this point. I might try and look at it in the next few weeks. It's GitHub Satellite this week and I'm on vacation the next.

Beauty! Many thanks. 🙏

@tarebyte tarebyte changed the base branch from master to 4-stable October 19, 2020 18:40
@lucascaton
Copy link
Contributor

Hi @tarebyte! Unfortunately, @titanium-cranium has recently moved on to another company and I'm now picking up the ball to determine the status of the proposed fix. #dejavu 😅

Is there any news on this? Could you please review and merge this change? Thank you!

r7kamura added a commit to r7kamura/gialog-sync that referenced this pull request May 6, 2022
@r7kamura r7kamura mentioned this pull request May 6, 2022
@nickfloyd nickfloyd added Type: Breaking change Used to note any change that requires a major version bump and removed breaking change labels Oct 28, 2022
@nickfloyd
Copy link
Contributor

'👋 Hey Friends, this pull request has been marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: pinned label if this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!'

@nickfloyd nickfloyd closed this Nov 1, 2022
@nickfloyd nickfloyd added the Status: Stale Used by stalebot to clean house label Nov 1, 2022
@lucascaton
Copy link
Contributor

Hey @nickfloyd! 👋 Why not merge it, instead?

We've been using a fork with this solution and it's been working well since 2019 (when this PR was opened).

@nickfloyd nickfloyd reopened this Nov 2, 2022
@nickfloyd
Copy link
Contributor

Hey @lucascaton, thanks for the response; we can do that! Being over a year old with merge conflicts will make that a bit challenging if we do not have push access to envato:lparry/fix-broken-encoding. Would you be interested in resolving those conflicts so we can give this a proper review and potentially get it merged in?

If not, no worries; we'll prioritize it and see if we can reach out to @lparry to enable edits for maintainers if needed, if not we can hoist these changes into another more recent branch of main and get it in that way.

@nickfloyd nickfloyd added Priority: Normal and removed Status: Stale Used by stalebot to clean house labels Nov 2, 2022
@lucascaton
Copy link
Contributor

Hi @nickfloyd, I've just merged main into this branch, it should be all good to review now 🙂 Thanks!

@lucascaton
Copy link
Contributor

Hi @nickfloyd, is there anything else you'd like me to change? Thanks!

Copy link
Contributor

@nickfloyd nickfloyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! ❤️

@nickfloyd nickfloyd merged commit 13efb0c into octokit:main Nov 14, 2022
@lucascaton lucascaton deleted the lparry/fix-broken-encoding branch November 21, 2022 00:22
@lucascaton lucascaton restored the lparry/fix-broken-encoding branch November 21, 2022 00:22
@lucascaton lucascaton deleted the lparry/fix-broken-encoding branch December 19, 2022 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Breaking change Used to note any change that requires a major version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Readme downloaded with wrong encoding
9 participants