We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 544e0c2 commit 39e22efCopy full SHA for 39e22ef
lib/base64.rb
@@ -82,13 +82,7 @@ def strict_decode64(str)
82
# You can remove the padding by setting +padding+ as false.
83
def urlsafe_encode64(bin, padding: true)
84
str = strict_encode64(bin)
85
- unless padding
86
- if str.end_with?("==")
87
- str.delete_suffix!("==")
88
- elsif str.end_with?("=")
89
- str.chop!
90
- end
91
+ str.chomp!("==") or str.chomp!("=") unless padding
92
str.tr!("+/", "-_")
93
str
94
end
0 commit comments