Permalink
Browse files

use corresponding path name for cached files

If there are two different coffee files with the same name
sitting in different directories, cache would serve them
incorrectly thus breaking the application.
  • Loading branch information...
1 parent 1ada493 commit 3fa03d50ae3397c1aa01c24aac2453bf2d6d7600 Kent Sibilev committed Mar 27, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/rack/coffee.rb
View
@@ -39,7 +39,9 @@ def set_cache_header_opts(given)
def brew(file)
if cache_compile_dir
- cache_file = cache_compile_dir + "#{file.mtime.to_i}_#{file.basename}"
+ path = cache_compile_dir + file.dirname
+ path.mkpath
+ cache_file = path + "#{file.mtime.to_i}_#{file.basename}"
if cache_file.file?
cache_file.read
else

0 comments on commit 3fa03d5

Please sign in to comment.