Skip to content
This repository
Browse code

Fix WSOD due to modification of a formatted template extension so tha…

…t requests to templates like 'foo.html.erb' fail on the second hit. [Rick]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6506 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit bdb1fcc3b8e0293f8b099111da2302fedf4fd513 1 parent 142b074
risk danger olson authored April 08, 2007
2  actionpack/CHANGELOG
... ...
@@ -1,5 +1,7 @@
1 1
 *SVN*
2 2
 
  3
+* Fix WSOD due to modification of a formatted template extension so that requests to templates like 'foo.html.erb' fail on the second hit.  [Rick]
  4
+
3 5
 * Fix WSOD when template compilation fails [Rick]
4 6
 
5 7
 * Change ActionView template defaults.  Look for templates using the request format first, such as "show.html.erb" or "show.xml.builder", before looking for the old defaults like "show.erb" or "show.builder" [Rick]
6  actionpack/lib/action_view/base.rb
@@ -252,7 +252,7 @@ def render_file(template_path, use_full_path = true, local_assigns = {}) #:nodoc
252 252
         else
253 253
           template_extension = pick_template_extension(template_path).to_s
254 254
           template_file_name = full_template_path(template_path, template_extension)
255  
-          template_extension.gsub!(/^\w+\./, '') # strip off any formats
  255
+          template_extension = template_extension.gsub(/^\w+\./, '') # strip off any formats
256 256
         end
257 257
       else
258 258
         template_file_name = template_path
@@ -267,7 +267,7 @@ def render_file(template_path, use_full_path = true, local_assigns = {}) #:nodoc
267 267
           e.sub_template_of(template_file_name)
268 268
           raise e
269 269
         else
270  
-          raise TemplateError.new(find_base_path_for("#{template_path_without_extension}.#{template_extension}"), template_file_name, @assigns, template_source, e)
  270
+          raise TemplateError.new(find_base_path_for("#{template_path_without_extension}.#{template_extension}") || view_paths.first, template_file_name, @assigns, template_source, e)
271 271
         end
272 272
       end
273 273
     end
@@ -582,7 +582,7 @@ def compile_template(extension, template, file_name, local_assigns)
582 582
             logger.debug "Backtrace: #{e.backtrace.join("\n")}"
583 583
           end
584 584
 
585  
-          raise TemplateError.new(extract_base_path_from(file_name) || @view_paths.first, file_name || template, @assigns, template, e)
  585
+          raise TemplateError.new(extract_base_path_from(file_name) || view_paths.first, file_name || template, @assigns, template, e)
586 586
         end
587 587
 
588 588
         @@compile_time[render_symbol] = Time.now

0 notes on commit bdb1fcc

Please sign in to comment.
Something went wrong with that request. Please try again.