From 5a23540a80397d9d0a175f50352f484fd2cf0c99 Mon Sep 17 00:00:00 2001 From: Minkyu Lee Date: Sat, 6 Jul 2024 05:49:16 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20slack=20profile=20github=20validation=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- waffledotcom/src/batch/slack/schema.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/waffledotcom/src/batch/slack/schema.py b/waffledotcom/src/batch/slack/schema.py index 70d0713..368e0a3 100644 --- a/waffledotcom/src/batch/slack/schema.py +++ b/waffledotcom/src/batch/slack/schema.py @@ -44,9 +44,14 @@ def check_phone_number(cls, value: str | None) -> str | None: @classmethod def check_github_id(cls, value: str | None) -> str | None: result = urlparse(value) - assert result.scheme == "https", "Invalid URL scheme" - assert result.netloc in ["github.com", "www.github.com"], "Invalid URL netloc" - return str(result.path).split("/")[1] + if result.scheme != "https": + return None + if not isinstance(result.netloc, str): + return None + if result.netloc.endswith("github.com"): + return str(result.path).split("/")[1] + if result.netloc.endswith("github.io"): + return str(result.netloc).split(".")[0] class SlackMember(BaseModel):