Skip to content

Commit

Permalink
escape html to keep the document valid regardless of weird string input
Browse files Browse the repository at this point in the history
  • Loading branch information
atmos committed Dec 16, 2009
1 parent 15974b3 commit 6ea93bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 0 additions & 2 deletions Gemfile
Expand Up @@ -4,7 +4,6 @@ only :release do
end

only :development do
gem 'mg'
gem 'yard'
gem 'jeweler'
end
Expand All @@ -14,4 +13,3 @@ only :test do
gem 'nokogiri'
gem 'test-unit', :require_as => 'test/unit'
end

10 changes: 5 additions & 5 deletions lib/toadhopper.rb
Expand Up @@ -5,7 +5,7 @@

# Posts errors to the Hoptoad API
class ToadHopper
VERSION = "0.9.1"
VERSION = "0.9.2"

# Hoptoad API response
class Response < Struct.new(:status, :body, :errors); end
Expand All @@ -15,7 +15,7 @@ class Response < Struct.new(:status, :body, :errors); end
def initialize(api_key)
@api_key = api_key
end

# Sets patterns to +[FILTER]+ out sensitive data such as +/password/+, +/email/+ and +/credit_card_number/+
def filters=(*filters)
@filters = filters.flatten
Expand Down Expand Up @@ -94,14 +94,14 @@ def document_for(exception, options={})
:project_root => Dir.pwd
}.merge(options)

Haml::Engine.new(notice_template).render(Object.new, defaults)
Haml::Engine.new(notice_template, :escape_html => true).render(Object.new, defaults)
end

# @private
def backtrace_line(line)
Struct.new(:file, :number, :method).new(*line.match(%r{^([^:]+):(\d+)(?::in `([^']+)')?$}).captures)
end

# @private
def notice_template
File.read(::File.join(::File.dirname(__FILE__), 'notice.haml'))
Expand Down

0 comments on commit 6ea93bb

Please sign in to comment.