Skip to content

Commit 43feae2

Browse files
Accept linkedin profile with language option at the end (#123)
* Accept linkedin profile with language option at the end * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 87d4efd commit 43feae2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/models/europython.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def extract_linkedin_url(text: str) -> str | None:
156156
linkedin_url = f"https://{cleaned}"
157157

158158
if not re.match(
159-
r"^https://([\w-]+\.)?linkedin\.com/in/(?:[\w\-]|%[0-9A-Fa-f]{2})+$",
159+
r"^https://([\w-]+\.)?linkedin\.com/in/(?:[\w\-]|%[0-9A-Fa-f]{2})+(?:/[\w\-]+)*$",
160160
linkedin_url,
161161
):
162162
print(f"Invalid LinkedIn URL: {linkedin_url}")

tests/test_extract_socials.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ def test_extract_mastodon_url(input_string, result):
5050
"https://regional.linkedin.com/in/example",
5151
"https://regional.linkedin.com/in/example",
5252
),
53+
("in/user123/nl", "https://linkedin.com/in/user123/nl"),
54+
(
55+
"https://nl.linkedin.com/in/user123/en",
56+
"https://nl.linkedin.com/in/user123/en",
57+
),
5358
],
5459
)
5560
def test_extract_linkedin_url(input_string, result):

0 commit comments

Comments
 (0)