summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/base64.rb8
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/base64.rb b/lib/base64.rb
index 6b049982cf..de1e8c0e55 100644
--- a/lib/base64.rb
+++ b/lib/base64.rb
@@ -82,13 +82,7 @@ module Base64
# You can remove the padding by setting +padding+ as false.
def urlsafe_encode64(bin, padding: true)
str = strict_encode64(bin)
- unless padding
- if str.end_with?("==")
- str.delete_suffix!("==")
- elsif str.end_with?("=")
- str.chop!
- end
- end
+ str.chomp!("==") or str.chomp!("=") unless padding
str.tr!("+/", "-_")
str
end