diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2012-01-19 12:49:20 +0000 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2012-01-19 12:49:20 +0000 |
commit | e06ab9fcc47addc2f397070414a60172080bdd84 (patch) | |
tree | 9b30ecdc94f799e0682b6a8077bfa941759001af /app/controllers/application_controller.rb | |
parent | 45e3ecda924473817a22e88b25b24fb770b5029c (diff) |
Don't choke on very long filenames when caching attachments. Fixes #349.
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r-- | app/controllers/application_controller.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0c8544932..2108b9d45 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -180,7 +180,10 @@ class ApplicationController < ActionController::Base path = foi_fragment_cache_part_path(param) path = "/views" + path foi_cache_path = File.join(File.dirname(__FILE__), '../../cache') - return File.join(foi_cache_path, path) + max_file_length = 255 - 35 # we subtract 35 because tempfile + # adds on a variable number of + # characters + return File.join(foi_cache_path, path)[0...max_file_length] end def foi_fragment_cache_all_for_request(info_request) # return stub path so admin can expire it |