mirror of
				https://github.com/elyby/chrly.git
				synced 2025-05-31 14:11:51 +05:30 
			
		
		
		
	Fixes CHRLY-S. Don't return an error for an invalid username
This commit is contained in:
		| @@ -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) | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user