notifico icon indicating copy to clipboard operation
notifico copied to clipboard

Gitlab push event when previous commit hash starts with '0' shows as 'branch created'

Open UnknownShadow200 opened this issue 5 years ago • 0 comments

When a branch is created, a special push event is sent with a before commit hash of 0000000000000000000000000000000000000000, which shows up as a User created branch TestBranch message.

However, a few normal push events with a before commit hash such as 0b29bd12533c9da60538fb135450a6508da52753 are wrongly showing up as a User created branch master message instead of the normal commit pushed message.


The regex 0+ is used in to detect a 'branch created' push event in gitlab.py: https://github.com/TkTech/notifico/blob/6b4eaa61c96b55d6c75135626798e04c63f6f428/notifico/services/hooks/gitlab.py#L182 and https://github.com/TkTech/notifico/blob/6b4eaa61c96b55d6c75135626798e04c63f6f428/notifico/services/hooks/gitlab.py#L500

However, this regex is not strict enough and matches all commit hashes whose first digit is 0, not just the one commit hash where all the digits are 0. It should be changed to a stricter regex such as 0+$.

UnknownShadow200 avatar Oct 30 '20 14:10 UnknownShadow200