From bd5bc81d1c542be9ba1c664a05b87cd26c8852ef Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 14 Aug 2019 15:28:20 +0100 Subject: [PATCH] match .lower() repo names against .lower() hooked repo names --- modules/git_webhooks/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/git_webhooks/__init__.py b/modules/git_webhooks/__init__.py index 9af34d74..7dce8145 100644 --- a/modules/git_webhooks/__init__.py +++ b/modules/git_webhooks/__init__.py @@ -65,13 +65,14 @@ class Module(ModuleManager.BaseModule): repo_hooked = False for server_id, channel_name, hooked_repos in hooks: + hooked_repos_lower = {k.lower(): v for k, v in hooked_repos.items()} found_hook = None - if full_name_lower and full_name_lower in hooked_repos: - found_hook = hooked_repos[full_name_lower] - elif repo_username_lower and repo_username_lower in hooked_repos: - found_hook = hooked_repos[repo_username_lower] - elif organisation_lower and organisation_lower in hooked_repos: - found_hook = hooked_repos[organisation_lower] + if full_name_lower and full_name_lower in hooked_repos_lower: + found_hook = hooked_repos_lower[full_name_lower] + elif repo_username_lower and repo_username_lower in hooked_repos_lower: + found_hook = hooked_repos_lower[repo_username_lower] + elif organisation_lower and organisation_lower in hooked_repos_lower: + found_hook = hooked_repos_lowers[organisation_lower] else: continue