Level command on user without avatarUrl result in index out of bound in go
Opened this issue · 1 comments
ArmandBriere commented
Is your feature request related to a problem? Please describe.
!level @userwithoutavatar
-> This is broken
Describe the solution you'd like
The level.go
file is the problem on the regex
re := regexp.MustCompile("avatars/(.*).png")
var subMatch = re.FindStringSubmatch(user.AvatarUrl)
if len(subMatch) < 2 {
re := regexp.MustCompile("avatars/(.*).gif")
subMatch = re.FindStringSubmatch(user.AvatarUrl)
}
user.AvatarId = subMatch[1]
The subMatch[1]
result in an index out of bound, this need to be fix
rafiramadhana commented
Hi @ArmandBriere , I am interested to work on this.
But some questions:
- Do we expect
user.AvatarId
to be left unset (i.e. empty string) on user withoutavatarUrl
? - Could you provide an example of valid
user.AvatarUrl
? I need this for the unit test
Thanks!