File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ def self.support_ipv6?
133133 # Determine whether this is a valid DNS name without trying to resolve it
134134 #
135135 def self . is_name? ( name )
136- return false if name . length > 253
136+ return false if name . length > 253 || name =~ MATCH_IPV4 || name =~ MATCH_IPV6
137137 name . delete_suffix ( '.' ) =~ MATCH_DNS_NAME ? ( name =~ /\s / ) . nil? : false
138138 end
139139
Original file line number Diff line number Diff line change 370370 described_class . is_name? ( try )
371371 end
372372
373+ context 'with an ip address' do
374+ let ( :try ) { '192.168.1.1' }
375+ it 'should return false' do
376+ expect ( name ) . to eq false
377+ end
378+ end
379+
373380 context 'with a hostname' do
374381 let ( :try ) { "localhost" }
375382 it "should return true" do
You can’t perform that action at this time.
0 commit comments