Skip to content

Commit f366365

Browse files
committed
Use strict_encode64 if possible
1 parent 65b875d commit f366365

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/onelogin/ruby-saml/saml_message.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ def decode(string)
121121
# @return [String] The encoded string
122122
#
123123
def encode(string)
124-
Base64.encode64(string).gsub(/\n/, "")
124+
if Base64.respond_to?('strict_encode64')
125+
Base64.strict_encode64(string)
126+
else
127+
Base64.encode64(string).gsub(/\n/, "")
128+
end
125129
end
126130

127131
# Check if a string is base64 encoded

0 commit comments

Comments
 (0)