Skip to content

Commit 86b46fa

Browse files
authored
Merge pull request #173 from github/nil-check
Add a missing nil check around cname_to_domain_to_pages?
2 parents f44d1b8 + 929ea6f commit 86b46fa

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

lib/github-pages-health-check/domain.rb

+4
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,17 @@ def cname_to_github_user_domain?
245245

246246
# Check if the CNAME points to a Domain that points to pages
247247
# e.g. CNAME -> Domain -> Pages
248+
# rubocop:disable Metrics/AbcSize
248249
def cname_to_domain_to_pages?
250+
return false unless dns?
251+
249252
a_record_to_pages = dns.select { |d| d.type == Dnsruby::Types::A && d.name.to_s == host }.first
250253

251254
return false unless a_record_to_pages && cname? && !cname_to_pages_dot_github_dot_com? && @www_cname
252255

253256
CURRENT_IP_ADDRESSES.include?(a_record_to_pages.address.to_s.downcase)
254257
end
258+
# rubocop:enable Metrics/AbcSize
255259

256260
# Is the given domain a CNAME to pages.github.(io|com)
257261
# instead of being CNAME'd to the user's subdomain?

lib/github-pages-health-check/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
module GitHubPages
44
module HealthCheck
5-
VERSION = "1.18.4"
5+
VERSION = "1.18.5"
66
end
77
end

spec/github_pages_health_check/domain_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@
671671
end
672672
end
673673

674-
context "Protocol redirections" do
674+
context "Protocol redirections", :retry => 3, :retry_wait => 1 do
675675
before do
676676
@out = []
677677

@@ -724,7 +724,7 @@ def stop
724724
@servers.each(&:stop)
725725
end
726726

727-
it "it does not follow anything other than http/https by default", :retry => 3 do
727+
it "it does not follow anything other than http/https by default" do
728728
Typhoeus.get(
729729
"http://localhost:#{@servers[1].port}",
730730
GitHubPages::HealthCheck.typhoeus_options
@@ -733,7 +733,7 @@ def stop
733733
expect(@out).to_not include("HIT #{@servers[0].port}")
734734
end
735735

736-
it "it follows ftp if requested (negative test)", :retry => 3 do
736+
it "it follows ftp if requested (negative test)" do
737737
Typhoeus.get(
738738
"http://localhost:#{@servers[1].port}",
739739
GitHubPages::HealthCheck.typhoeus_options.merge(:redir_protocols => %i[http https ftp])

0 commit comments

Comments
 (0)