Skip to content
Browse files

Fix line number detection and escape RAILS_ROOT in backtrace Regexp

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2773 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 706a8a8 commit f2c920ec24f318e28c0a1e78c019a331368ff5bb @seckar seckar committed
View
2 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]
View
3 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}
%>
View
3 actionpack/lib/action_view/template_error.rb
@@ -47,7 +47,7 @@ def sub_template_of(file_name)
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 @@ def strip_base_path(file_name)
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)

0 comments on commit f2c920e

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