Skip to content

Commit

Permalink
Improve wordpress.com SPECIAL rule.
Browse files Browse the repository at this point in the history
This patch fixes #321.

Indeed, before this patch, we weren't handling the case that a
subdomain has been shutdown by wordpress.com.
This patch handle the situation by handling the 410 status code.

Contributors:
  * @spirillen
  • Loading branch information
funilrys committed Dec 25, 2022
1 parent 09c5b3c commit 411ab26
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions PyFunceble/checker/availability/extras/rules.py
Expand Up @@ -96,7 +96,10 @@ def __init__(self, status: Optional[AvailabilityCheckerStatus] = None) -> None:
r"\.skyrock\.com$": [(self.__switch_to_down_if, 404)],
r"\.tumblr\.com$": [(self.__switch_to_down_if, 404)],
r"\.wix\.com$": [(self.__switch_to_down_if, 404)],
r"\.wordpress\.com$": [self.__handle_wordpress_dot_com],
r"\.wordpress\.com$": [
(self.__switch_to_down_if, 410),
self.__handle_wordpress_dot_com,
],
r"\.weebly\.com$": [(self.__switch_to_down_if, 404)],
}

Expand Down Expand Up @@ -149,14 +152,17 @@ def __regex_registry_handler(self, regex_registry: dict) -> "ExtraRulesHandler":
) in regex_registry.items():
broken = False
for element in data:
if RegexHelper(regex).match(
if not RegexHelper(regex).match(
self.status.idna_subject, return_match=False
):
if isinstance(element, tuple):
element[0](*element[1:])
else:
element()
continue

if isinstance(element, tuple):
element[0](*element[1:])
else:
element()

if self.status.status_after_extra_rules:
broken = True
break

Expand Down Expand Up @@ -205,7 +211,7 @@ def __handle_wordpress_dot_com(self) -> "ExtraRulesHandler":
This method assume that we know that we are handling a blogspot domain.
"""

regex_wordpress = [r"doesn’t exist"]
regex_wordpress = [r"doesn’t exist", r"no\slonger\savailable"]

if self.status.idna_subject.startswith(
"http:"
Expand Down

0 comments on commit 411ab26

Please sign in to comment.