From a75a84d9630d81dfcad89ceb0ba2fc31274c4258 Mon Sep 17 00:00:00 2001 From: Sara Subijana Gracia Date: Mon, 10 Jun 2024 15:46:07 +0200 Subject: [PATCH] fix: add special char to token pattern to allow tokens with that --- TNTGitHook/utils.py | 2 +- utils_test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TNTGitHook/utils.py b/TNTGitHook/utils.py index a6c1299..db3752c 100644 --- a/TNTGitHook/utils.py +++ b/TNTGitHook/utils.py @@ -45,7 +45,7 @@ def first(function: Callable[[T], bool], iterable: Iterable[T]) -> T: def formatRemoteURL(remoteURL) -> str: userPattern = "\/+\w.*\:" - tokenPattern = "\:+([\w\d]*)@" + tokenPattern = "\:+([\w\d-]*)@" if(remoteURL is None): return remoteURL diff --git a/utils_test.py b/utils_test.py index 3adbe80..7da90ff 100644 --- a/utils_test.py +++ b/utils_test.py @@ -32,7 +32,7 @@ def test_parse_full_activities_data(self): self.assertIsNotNone(activity.projectRole) def test_replace_user_and_token_when_remote_url_contains_them(self): - remoteURL = "https://nassr.mousati:ghp_LuToBb2F@github.com/user/dummy.git" + remoteURL = "https://nassr.mousati:ghp_LuToBb2F-@github.com/user/dummy.git" expectedRemoteURL = "https://****:****@github.com/user/dummy.git" formatedRemoteURL = formatRemoteURL(remoteURL) self.assertEqual(formatedRemoteURL, expectedRemoteURL)