diff options
-rw-r--r-- | lib/base64.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/base64.rb b/lib/base64.rb index de1e8c0e55..693aa1f519 100644 --- a/lib/base64.rb +++ b/lib/base64.rb @@ -99,9 +99,11 @@ module Base64 # NOTE: RFC 4648 does say nothing about unpadded input, but says that # "the excess pad characters MAY also be ignored", so it is inferred that # unpadded input is also acceptable. - str = str.tr("-_", "+/") if !str.end_with?("=") && str.length % 4 != 0 str = str.ljust((str.length + 3) & ~3, "=") + str.tr!("-_", "+/") + else + str = str.tr("-_", "+/") end strict_decode64(str) end |