fix(chuffed): Support https://chuffed.org/pay/campaign/<id> campaign URL format
This commit is contained in:
parent
0ce61f4e7b
commit
6272ffaf1a
1 changed files with 4 additions and 2 deletions
|
|
@ -192,12 +192,14 @@ class ChuffedCampaignSource(CampaignSource): # pylint: disable=too-few-public-m
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def url_pattern(self) -> re.Pattern:
|
def url_pattern(self) -> re.Pattern:
|
||||||
return re.compile(r"^https://(www\.)?chuffed\.org/project/([a-zA-Z0-9\-]+)")
|
return re.compile(
|
||||||
|
r"^https://(www\.)?chuffed\.org/(project|pay/campaign)/([a-zA-Z0-9\-]+)"
|
||||||
|
)
|
||||||
|
|
||||||
def parse_url(self, url: str) -> str | None:
|
def parse_url(self, url: str) -> str | None:
|
||||||
match = self.url_pattern.match(url)
|
match = self.url_pattern.match(url)
|
||||||
if match:
|
if match:
|
||||||
return f"https://www.chuffed.org/project/{match.group(2)}"
|
return f"https://www.chuffed.org/project/{match.group(3)}"
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue