This project is archived and is in readonly mode.
ActiveSupport::Cache::FileStore: undefined method `ord' for nil:NilClass
Reported by Igor Galeta | October 21st, 2010 @ 12:49 PM | in 3.0.2
undefined method ord' for nil:NilClass
This issue raise in rails 3.0.0 and rails 3.0.1, when I using file_store for cache_store.
config.action_controller.cache_store = ActiveSupport::Cache::FileStore.new(Rails.root.join("tmp", "cache").to_s)
My fix:
module ActiveSupport
module Cache
class FileStore < Store
private
# Translate a file path into a key.
def file_path_key(path)
fname = path[cache_path.size, path.size].split(File::SEPARATOR, 4).last
fname.gsub(UNESCAPE_FILENAME_CHARS){|match| [match.delete('%')].pack('H*') }
end
end
end
end
Comments and changes to this ticket
-
Aditya Sanghi October 21st, 2010 @ 01:53 PM
- Importance changed from “” to “Low”
Can you please submit a failing test and a patch as per the contributor's guide?
It wasn't very clear what the scenario in which error happens or steps to reproduce the error.
-
Santiago Pastorino October 21st, 2010 @ 02:46 PM
- State changed from “new” to “open”
- Milestone set to “3.0.2”
- Assigned user set to “Santiago Pastorino”
Igor can you provide a patch following http://rails.lighthouseapp.com/projects/8994/sending-patches or at least a failing test case?.
Thanks. -
Denis Odorcic October 23rd, 2010 @ 07:04 AM
Attached is a patch and failing test.
The issue was that with FileStore, the key is the filename, which was being escaped properly, but not unescaped. This only presents itself when the cache is FileStore, the key contains characters that get escaped, and expire_fragment is called with a Regular expression.
The fix that Igor provided above does fix the issue, however the escaping and unescaping is essentially the same method used by CGI, so my patch uses that instead.
If you think it should go back to how it was and just use Igor's fix, that's fine. -
Denis Odorcic October 23rd, 2010 @ 09:54 PM
- Tag changed from “activesupport, caching, file_store, rails3.0.0, rails3.0.1” to “activesupport, caching, file_store, patch, rails3.0.0, rails3.0.1”
-
Santiago Pastorino November 7th, 2010 @ 07:02 PM
Please use Rack::Utils.escape and unscape instead of CGI one.
-
Denis Odorcic November 7th, 2010 @ 08:02 PM
I've attached an updated patch using Rack::Utils. Thanks!
-
Santiago Pastorino November 7th, 2010 @ 08:12 PM
- State changed from “open” to “verified”
-
Repository November 7th, 2010 @ 10:03 PM
- State changed from “verified” to “committed”
(from [c452d734f202fef3560173cd10701be8ff1a057b]) Fix FileStore cache incorrectly regenerating its key from a pathname when a regexp is used in expire_fragment
[#5850 state:committed]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
https://github.com/rails/rails/commit/c452d734f202fef3560173cd10701... -
Repository November 7th, 2010 @ 10:03 PM
(from [ad2c0bdb9b94c79553e76f6b2db6fb23ccff6a97]) Fix FileStore cache incorrectly regenerating its key from a pathname when a regexp is used in expire_fragment
[#5850 state:committed]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
https://github.com/rails/rails/commit/ad2c0bdb9b94c79553e76f6b2db6f...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 5611 active_support/cache/file_store.rb is this correct? Oh, looks like this is a duplicate of #5850 where I submi...
- 5611 active_support/cache/file_store.rb is this correct? Denis yeah I know ;). I wanted to apply this patch before...
- 5850 ActiveSupport::Cache::FileStore: undefined method `ord' for nil:NilClass [#5850 state:committed]
- 5850 ActiveSupport::Cache::FileStore: undefined method `ord' for nil:NilClass [#5850 state:committed]
- 5611 active_support/cache/file_store.rb is this correct? Duplicate of #5850