Skip to content

Commit

Permalink
simplify check
Browse files Browse the repository at this point in the history
  • Loading branch information
tsusdere committed Apr 9, 2024
1 parent 2eea686 commit 0ea9a33
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lib/github-pages-health-check/domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,21 +238,13 @@ def non_github_pages_ip_present?
.any? { |a| !github_pages_ip?(a.address.to_s) }
end

# Is the domain's first response a CNAME to a pages domain or a domain to pages?
# Is the domain's first response a CNAME to a pages domain?
def cname_to_github_user_domain?
# If the domain does not match check if the host value points to a pages
# domain.
#
# e.g 'www.domain.com' -> 'domain.com' -> 'Pages' is valid
if cname? && !cname_to_pages_dot_github_dot_com?
# CNAME points to Pages
if cname.pages_domain?
return true
# CNAME points to a domain which might point to Pages
else
return Domain.redundant(host)
end
end
cname? && !cname_to_pages_dot_github_dot_com? && (cname.pages_domain? || Domain.redundant(host))
end

# Is the given domain a CNAME to pages.github.(io|com)
Expand Down

0 comments on commit 0ea9a33

Please sign in to comment.