Fixes CHRLY-S. Don't return an error for an invalid username

This commit is contained in:
ErickSkrauch 2021-03-03 00:24:31 +01:00
parent d1d2c7ee6e
commit 1e3307dcbe
2 changed files with 2 additions and 3 deletions

View File

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

View File

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