Skip to content

Commit

Permalink
.dup key before forcing encoding, petergoldsteinGH-162
Browse files Browse the repository at this point in the history
This matches what AS 3.2 does already.
  • Loading branch information
mperham committed Jan 23, 2012
1 parent 3b7fdf4 commit 969b99a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion History.md
Expand Up @@ -4,7 +4,8 @@ Dalli Changelog
HEAD
=======

- Fix double namespacing with Rails and dalli\_store.
- Fix encoding issue with keys [#162]
- Fix double namespacing with Rails and dalli\_store. [#160]

1.1.4
=======
Expand Down
4 changes: 2 additions & 2 deletions lib/active_support/cache/dalli_store.rb
Expand Up @@ -149,8 +149,8 @@ def delete_entry(key, options) # :nodoc:

private
def escape_key(key)
key = key.to_s
key = key.force_encoding('ASCII-8BIT') if key.respond_to? :force_encoding
key = key.to_s.dup
key = key.force_encoding('BINARY') if key.respond_to? :force_encoding
key = key.gsub(ESCAPE_KEY_CHARS){|match| "%#{match.getbyte(0).to_s(16).upcase}"}
key = "#{key[0, 213]}:md5:#{Digest::MD5.hexdigest(key)}" if key.size > 250
key
Expand Down

0 comments on commit 969b99a

Please sign in to comment.