Skip to content

Commit

Permalink
Fix: bug in repo link field w markdown url
Browse files Browse the repository at this point in the history
  • Loading branch information
lwasser committed Aug 24, 2023
1 parent d32fde4 commit cc74467
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/pyosmeta/parse_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ def clean_date(a_date: Optional[str]) -> str:

if a_date is None or a_date == "missing":
return "missing"
# elif len(a_date) < 11:
# new_date = a_date.replace("/", "-").split("-")
# return f"{new_date[0]}-{new_date[1]}-{new_date[2]}"
else:
try:
return (
Expand Down Expand Up @@ -133,6 +130,23 @@ def clean_date(cls, a_date: Optional[str]) -> str:

return clean_date(a_date)

@field_validator(
"repository_link",
mode="before",
)
@classmethod
def clean_markdown_url(cls, repo: str) -> str:
"""Remove markdown link remnants from gh usernames and name.
Sometimes editors and reviewers add names using github links.
Remove the link data.
"""

if repo.startswith("["):
return repo.split("](")[0].replace("[", "")
else:
return repo

@field_validator(
"editor",
"reviewer_1",
Expand Down

0 comments on commit cc74467

Please sign in to comment.