mirror of
https://github.com/elyby/chrly.git
synced 2024-12-22 21:19:55 +05:30
Учитываем пустой input для методов FindByUsername
This commit is contained in:
parent
676ba03c37
commit
11a7570f51
@ -14,6 +14,10 @@ type filesDb struct {
|
||||
|
||||
func (repository *filesDb) FindByUsername(username string) (model.Cape, error) {
|
||||
var record model.Cape
|
||||
if username == "" {
|
||||
return record, CapeNotFoundError{username}
|
||||
}
|
||||
|
||||
capePath := path.Join(repository.path, strings.ToLower(username) + ".png")
|
||||
file, err := os.Open(capePath)
|
||||
if err != nil {
|
||||
|
@ -18,6 +18,10 @@ const accountIdToUsernameKey string = "hash:username-to-account-id"
|
||||
|
||||
func (db *redisDb) FindByUsername(username string) (model.Skin, error) {
|
||||
var record model.Skin
|
||||
if username == "" {
|
||||
return record, SkinNotFoundError{username}
|
||||
}
|
||||
|
||||
redisKey := buildKey(username)
|
||||
response := db.conn.Cmd("GET", redisKey)
|
||||
if response.IsType(redis.Nil) {
|
||||
|
Loading…
Reference in New Issue
Block a user