aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-12-28 10:22:48 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-12-28 10:22:48 -0800
commitafe6e059ea216f01d160e4603116356b78df12e5 (patch)
treee01ada46a3c3b6f2e2a67a8bf4234caf6ff1f995 /activesupport/lib
parentc8dcc19cf9e40c4387bfc197bc118da16c8469c3 (diff)
parenta19d0f5a66f17c356c5255c5d5930a73a25f627a (diff)
downloadrails-afe6e059ea216f01d160e4603116356b78df12e5.tar.gz
rails-afe6e059ea216f01d160e4603116356b78df12e5.tar.bz2
rails-afe6e059ea216f01d160e4603116356b78df12e5.zip
Merge pull request #4207 from nashby/deprecate-base64-encode64s
deprecate Base64.encode64s from AS
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/base64.rb6
-rw-r--r--activesupport/lib/active_support/message_encryptor.rb2
-rw-r--r--activesupport/lib/active_support/message_verifier.rb4
3 files changed, 8 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/base64.rb b/activesupport/lib/active_support/base64.rb
index b43d2ce9a3..41a1a3469d 100644
--- a/activesupport/lib/active_support/base64.rb
+++ b/activesupport/lib/active_support/base64.rb
@@ -3,12 +3,16 @@ require 'base64'
module ActiveSupport
Base64 = ::Base64
+ # *DEPRECATED*: Use +Base64.strict_encode64+ instead.
+ #
# Encodes the value as base64 without the newline breaks. This makes the base64 encoding readily usable as URL parameters
# or memcache keys without further processing.
#
# ActiveSupport::Base64.encode64s("Original unencoded string")
# # => "T3JpZ2luYWwgdW5lbmNvZGVkIHN0cmluZw=="
def Base64.encode64s(value)
- encode64(value).gsub(/\n/, '')
+ ActiveSupport::Deprecation.warn "encode64s " \
+ "is deprecated. Use Base64.strict_encode64 instead", caller
+ strict_encode64(value)
end
end
diff --git a/activesupport/lib/active_support/message_encryptor.rb b/activesupport/lib/active_support/message_encryptor.rb
index 7d8a7fb687..476ba0b3d1 100644
--- a/activesupport/lib/active_support/message_encryptor.rb
+++ b/activesupport/lib/active_support/message_encryptor.rb
@@ -56,7 +56,7 @@ module ActiveSupport
encrypted_data = cipher.update(@serializer.dump(value))
encrypted_data << cipher.final
- [encrypted_data, iv].map {|v| ActiveSupport::Base64.encode64s(v)}.join("--")
+ [encrypted_data, iv].map {|v| ActiveSupport::Base64.strict_encode64(v)}.join("--")
end
def _decrypt(encrypted_message)
diff --git a/activesupport/lib/active_support/message_verifier.rb b/activesupport/lib/active_support/message_verifier.rb
index 30ac44f6fa..7cb5b1e82d 100644
--- a/activesupport/lib/active_support/message_verifier.rb
+++ b/activesupport/lib/active_support/message_verifier.rb
@@ -18,7 +18,7 @@ module ActiveSupport
# self.current_user = User.find(id)
# end
#
- # By default it uses Marshal to serialize the message. If you want to use another
+ # By default it uses Marshal to serialize the message. If you want to use another
# serialization method, you can set the serializer attribute to something that responds
# to dump and load, e.g.:
#
@@ -44,7 +44,7 @@ module ActiveSupport
end
def generate(value)
- data = ActiveSupport::Base64.encode64s(@serializer.dump(value))
+ data = ActiveSupport::Base64.strict_encode64(@serializer.dump(value))
"#{data}--#{generate_digest(data)}"
end