FIX: nuke spammer from flags page

This commit is contained in:
Neil Lalonde 2014-02-21 14:14:30 -05:00
parent 9545e2e46e
commit 5fd390c600
2 changed files with 5 additions and 0 deletions

View File

@ -23,6 +23,8 @@ class ScreenedIpAddress < ActiveRecord::Base
return
end
return write_attribute(:ip_address, val) if val.is_a?(IPAddr)
num_wildcards = val.count('*')
if num_wildcards == 0
write_attribute(:ip_address, val)

View File

@ -66,6 +66,9 @@ describe ScreenedIpAddress do
test_good_value("210.56.12.12", "210.56.12.12")
test_good_value("210.56.0.0/16", "210.56.0.0/16")
test_good_value("fc00::/7", "fc00::/7")
test_good_value(IPAddr.new("94.99.101.228"), "94.99.101.228")
test_good_value(IPAddr.new("94.99.0.0/16"), "94.99.0.0/16")
test_good_value(IPAddr.new("fc00::/7"), "fc00::/7")
end
it "translates * characters" do