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

Remove Ruby <2.3 base64 decoding workaround #9

Merged
merged 1 commit into from
Jan 21, 2024

Conversation

rossta
Copy link
Contributor

@rossta rossta commented Jan 21, 2024

In older Ruby versions, WebPush.decode64 was introduced to wrap Base64.urlsafe_decode64 to prevent errors decoding "unpadded" urlsafe-encoded input.

Since Ruby 2.3, Base64.urlsafe_decode64 can now gracefully decode padded and unpadded input. Given WebPush now supports Ruby 3+, we should be able to remove this workaround gracefully.

I've added basic specs to demonstrate and perhaps catch any potential (though unlikely) future regressions in Ruby.

For historical discussion of the issue:
https://bugs.ruby-lang.org/issues/10740

In older Ruby versions, WebPush.decode64 was introduced to wrap
Base64.urlsafe_decode64 to prevent errors decoding "unpadded"
urlsafe-encoded input. Since Ruby 2.3, Base64.urlsafe_decode64 can now
gracefully decode padded and unpadded input. Given WebPush now supports
Ruby 3+, we should be able to remove this workaround gracefully. I've
added basic specs to demonstrate and perhaps catch any potential (though
unlikely) future regressions in Ruby.

For historical discussion of the issue:
https://bugs.ruby-lang.org/issues/10740
@collimarco collimarco merged commit f140f28 into pushpad:master Jan 21, 2024
6 checks passed
@collimarco
Copy link
Contributor

@rossta Thanks for the pull requests! I have merged them

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.

None yet

2 participants