diff --git a/grimoire_elk/raw/github.py b/grimoire_elk/raw/github.py index d96bc07ee..eac47f80b 100644 --- a/grimoire_elk/raw/github.py +++ b/grimoire_elk/raw/github.py @@ -95,6 +95,7 @@ def get_perceval_params_from_url(cls, url): """ Get the perceval params given a URL for the data source """ params = [] + url = url.rstrip('/') owner = url.split('/')[-2] repository = url.split('/')[-1] params.append(owner) diff --git a/releases/unreleased/github-url-ending-with-slash-failed.yml b/releases/unreleased/github-url-ending-with-slash-failed.yml new file mode 100644 index 000000000..1d466ac00 --- /dev/null +++ b/releases/unreleased/github-url-ending-with-slash-failed.yml @@ -0,0 +1,7 @@ +--- +title: GitHub URL ending with slash failed +category: fixed +author: Jose Javier Merchante +issue: 1159 +notes: > + GrimoireLab failed to run with GitHub URLs ending in a slash diff --git a/tests/test_github.py b/tests/test_github.py index 1f00428b0..33a99f0f5 100644 --- a/tests/test_github.py +++ b/tests/test_github.py @@ -218,6 +218,12 @@ def test_perceval_params(self): ] self.assertListEqual(GitHubOcean.get_perceval_params_from_url(url), expected_params) + url = "https://github.com/chaoss/grimoirelab-perceval/" + expected_params = [ + 'chaoss', 'grimoirelab-perceval' + ] + self.assertListEqual(GitHubOcean.get_perceval_params_from_url(url), expected_params) + def test_demography_study(self): """ Test that the demography study works correctly """