Use hash instead of encoded file path as file name for temp files #137

Closed
wants to merge 2 commits into from

2 participants

@baversjo

As sprockets would use the encoded file path as file name for temp files,
these filenames can become very long if the number of sub directories is high.
This becomes a problem on linux filesystems as the filename limit is 255 characters.

I originally posted an issue in rails:
rails/rails#2308

@baversjo baversjo use hash instead of encoded file path as file name for temp files
As sprockets would use the encoded file path as file name for temp files,
these filenames can become very long if the number of sub directories is high.
This becomes a problem on linux filesystems as the filename limit is 255 characters.
b634d69
@josh

Rails's old store used to create directories for / instead of escaping them.

https://github.com/rails/rails/blob/2-3-stable/activesupport/lib/active_support/cache/file_store.rb

@josh

Memcache keys also need to be under 250c. So maybe this is a good idea. Probably going to make shit harder to debug though.

@baversjo

It's probably a bit faster not to create subdirectories. Is there anything else I should add to this pull request?

@josh

Lets keep cache_key_namespace in the key. So generate sprockets/098f6bcd4621d373cade4e832627b4f6.

@josh josh added a commit that closed this pull request Jul 27, 2011
@josh josh Hash cache key to avoid exceeding 250c
Fixes #137
4a12801
@josh josh closed this in 4a12801 Jul 27, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment