mirror of
https://github.com/elyby/chrly.git
synced 2024-11-22 21:23:17 +05:30
Fixes CHRLY-S. Don't return an error for an invalid username
This commit is contained in:
parent
d1d2c7ee6e
commit
1e3307dcbe
@ -1,7 +1,6 @@
|
||||
package mojangtextures
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync"
|
||||
@ -92,7 +91,7 @@ func (ctx *Provider) GetForUsername(username string) (*mojang.SignedTexturesResp
|
||||
})
|
||||
|
||||
if !allowedUsernamesRegex.MatchString(username) {
|
||||
return nil, errors.New("invalid username")
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
username = strings.ToLower(username)
|
||||
|
@ -391,7 +391,7 @@ func (suite *providerTestSuite) TestGetForTheSameUsernames() {
|
||||
|
||||
func (suite *providerTestSuite) TestGetForNotAllowedMojangUsername() {
|
||||
result, err := suite.Provider.GetForUsername("Not allowed")
|
||||
suite.Assert().Error(err, "invalid username")
|
||||
suite.Assert().Nil(err)
|
||||
suite.Assert().Nil(result)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user