mirror of
https://github.com/elyby/chrly.git
synced 2024-11-23 05:33:18 +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
|
package mojangtextures
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@ -92,7 +91,7 @@ func (ctx *Provider) GetForUsername(username string) (*mojang.SignedTexturesResp
|
|||||||
})
|
})
|
||||||
|
|
||||||
if !allowedUsernamesRegex.MatchString(username) {
|
if !allowedUsernamesRegex.MatchString(username) {
|
||||||
return nil, errors.New("invalid username")
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
username = strings.ToLower(username)
|
username = strings.ToLower(username)
|
||||||
|
@ -391,7 +391,7 @@ func (suite *providerTestSuite) TestGetForTheSameUsernames() {
|
|||||||
|
|
||||||
func (suite *providerTestSuite) TestGetForNotAllowedMojangUsername() {
|
func (suite *providerTestSuite) TestGetForNotAllowedMojangUsername() {
|
||||||
result, err := suite.Provider.GetForUsername("Not allowed")
|
result, err := suite.Provider.GetForUsername("Not allowed")
|
||||||
suite.Assert().Error(err, "invalid username")
|
suite.Assert().Nil(err)
|
||||||
suite.Assert().Nil(result)
|
suite.Assert().Nil(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user