Use rpartition to either get the last part of a ref/head/branch ref or just

`branch` (github)
This commit is contained in:
jesopo 2019-01-23 08:56:36 +00:00
parent fcbb530b9e
commit 756938a4c9

View file

@ -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")