From 84eda8999a5d269b9949f0a703547a5638a6241b Mon Sep 17 00:00:00 2001 From: egeakman Date: Fri, 18 Apr 2025 19:08:55 -0400 Subject: [PATCH 1/2] Accept linkedin profile with language option at the end --- src/models/europython.py | 2 +- tests/test_extract_socials.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/models/europython.py b/src/models/europython.py index 8731ec0..689200b 100644 --- a/src/models/europython.py +++ b/src/models/europython.py @@ -156,7 +156,7 @@ def extract_linkedin_url(text: str) -> str | None: linkedin_url = f"https://{cleaned}" if not re.match( - r"^https://([\w-]+\.)?linkedin\.com/in/(?:[\w\-]|%[0-9A-Fa-f]{2})+$", + r"^https://([\w-]+\.)?linkedin\.com/in/(?:[\w\-]|%[0-9A-Fa-f]{2})+(?:/[\w\-]+)*$", linkedin_url, ): print(f"Invalid LinkedIn URL: {linkedin_url}") diff --git a/tests/test_extract_socials.py b/tests/test_extract_socials.py index 6eb27a0..f92a388 100644 --- a/tests/test_extract_socials.py +++ b/tests/test_extract_socials.py @@ -50,6 +50,8 @@ def test_extract_mastodon_url(input_string, result): "https://regional.linkedin.com/in/example", "https://regional.linkedin.com/in/example", ), + ("in/user123/nl", "https://linkedin.com/in/user123/nl"), + ("https://nl.linkedin.com/in/user123/en", "https://nl.linkedin.com/in/user123/en"), ], ) def test_extract_linkedin_url(input_string, result): From 185eb757503028f0faf0bb97223ef8470d14d584 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 18 Apr 2025 23:09:16 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_extract_socials.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_extract_socials.py b/tests/test_extract_socials.py index f92a388..f273182 100644 --- a/tests/test_extract_socials.py +++ b/tests/test_extract_socials.py @@ -51,7 +51,10 @@ def test_extract_mastodon_url(input_string, result): "https://regional.linkedin.com/in/example", ), ("in/user123/nl", "https://linkedin.com/in/user123/nl"), - ("https://nl.linkedin.com/in/user123/en", "https://nl.linkedin.com/in/user123/en"), + ( + "https://nl.linkedin.com/in/user123/en", + "https://nl.linkedin.com/in/user123/en", + ), ], ) def test_extract_linkedin_url(input_string, result):