aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_controller/templates/rescues/_trace.rhtml3
-rw-r--r--actionpack/lib/action_view/template_error.rb3
3 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index e7a9a0fe16..d1569931ee 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fix line number detection and escape RAILS_ROOT in backtrace Regexp [Nicholas Seckar]
+
* Fixed document.getElementsByClassName from Prototype to be speedy again [Sam Stephenson]
* Recognize ./#{RAILS_ROOT} as RAILS_ROOT in error traces [Nicholas Seckar]
diff --git a/actionpack/lib/action_controller/templates/rescues/_trace.rhtml b/actionpack/lib/action_controller/templates/rescues/_trace.rhtml
index 59dcf3d9e6..6260ec8bcb 100644
--- a/actionpack/lib/action_controller/templates/rescues/_trace.rhtml
+++ b/actionpack/lib/action_controller/templates/rescues/_trace.rhtml
@@ -4,9 +4,6 @@
["Framework Trace", @exception.framework_backtrace],
["Full Trace", @exception.clean_backtrace]
]
- if defined?(RAILS_ROOT)
- traces.each { |name, trace| trace.map! { |p| p.gsub(/^(?:\.\/)?#{RAILS_ROOT}/, '<b>#{RAILS_ROOT}</b>') } }
- end
names = traces.collect {|name, trace| name}
%>
diff --git a/actionpack/lib/action_view/template_error.rb b/actionpack/lib/action_view/template_error.rb
index b81173dafe..e21f7517b1 100644
--- a/actionpack/lib/action_view/template_error.rb
+++ b/actionpack/lib/action_view/template_error.rb
@@ -47,7 +47,7 @@ module ActionView
def line_number
if file_name
- regexp = /#{Regexp.escape File.basename(file_name)}:(\d+)\s*$/
+ regexp = /#{Regexp.escape File.basename(file_name)}:(\d+)/
[@original_exception.message, @original_exception.clean_backtrace].flatten.each do |line|
return $1.to_i if regexp =~ line
end
@@ -83,3 +83,4 @@ module ActionView
end
Exception::TraceSubstitutions << [/:in\s+`_run_(html|xml).*'\s*$/, ''] if defined?(Exception::TraceSubstitutions)
+Exception::TraceSubstitutions << [%r{^\s*#{Regexp.escape RAILS_ROOT}}, '#{RAILS_ROOT}'] if defined?(RAILS_ROOT)