Skip to content

Commit

Permalink
fix: slack profile github validation 개선
Browse files Browse the repository at this point in the history
  • Loading branch information
minkyu97 committed Jul 5, 2024
1 parent 95b996c commit 5a23540
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions waffledotcom/src/batch/slack/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 5a23540

Please sign in to comment.