lib/hackerone/client/activity.rb in hackerone-client-0.14.0 vs lib/hackerone/client/activity.rb in hackerone-client-0.14.1

- old
+ new

@@ -27,15 +27,31 @@ end class BountyAwarded < Activity def bounty_amount formatted_bounty_amount = attributes.bounty_amount || "0" - formatted_bounty_amount.gsub(/[^\d]/, "").to_i + if ENV[HackerOne::Client::LENIENT_MODE_ENV_VARIABLE] + Float(formatted_bounty_amount) rescue 0 + else + begin + Float(formatted_bounty_amount) + rescue ArgumentError + raise ArgumentError.new("Improperly formatted bounty amount") + end + end end def bonus_amount formatted_bonus_amount = attributes.bonus_amount || "0" - formatted_bonus_amount.gsub(/[^\d]/, "").to_i + if ENV[HackerOne::Client::LENIENT_MODE_ENV_VARIABLE] + Float(formatted_bonus_amount) rescue 0 + else + begin + Float(formatted_bonus_amount) + rescue ArgumentError + raise ArgumentError.new("Improperly formatted bonus amount") + end + end end end class SwagAwarded < Activity delegate :swag, to: :relationships