From 756938a4c9c0e2a81c48340bfe37c48cf544cffe Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 23 Jan 2019 08:56:36 +0000 Subject: [PATCH] Use `rpartition` to either get the last part of a `ref/head/branch` ref or just `branch` (github) --- modules/github/module.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/github/module.py b/modules/github/module.py index 6085face..7629af76 100644 --- a/modules/github/module.py +++ b/modules/github/module.py @@ -250,10 +250,7 @@ class Module(ModuleManager.BaseModule): branch = None if "ref" in data: - if "/" in data["ref"]: - branch = data["ref"].split("/", 2)[2] - else: - branch = data["ref"] + _, _, branch = data["ref"].rpartition("/") hooks = self.bot.database.channel_settings.find_by_setting( "github-hooks")