mirror of
https://github.com/elyby/chrly.git
synced 2024-12-23 21:50:03 +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) {
|
func (repository *filesDb) FindByUsername(username string) (model.Cape, error) {
|
||||||
var record model.Cape
|
var record model.Cape
|
||||||
|
if username == "" {
|
||||||
|
return record, CapeNotFoundError{username}
|
||||||
|
}
|
||||||
|
|
||||||
capePath := path.Join(repository.path, strings.ToLower(username) + ".png")
|
capePath := path.Join(repository.path, strings.ToLower(username) + ".png")
|
||||||
file, err := os.Open(capePath)
|
file, err := os.Open(capePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -18,6 +18,10 @@ const accountIdToUsernameKey string = "hash:username-to-account-id"
|
|||||||
|
|
||||||
func (db *redisDb) FindByUsername(username string) (model.Skin, error) {
|
func (db *redisDb) FindByUsername(username string) (model.Skin, error) {
|
||||||
var record model.Skin
|
var record model.Skin
|
||||||
|
if username == "" {
|
||||||
|
return record, SkinNotFoundError{username}
|
||||||
|
}
|
||||||
|
|
||||||
redisKey := buildKey(username)
|
redisKey := buildKey(username)
|
||||||
response := db.conn.Cmd("GET", redisKey)
|
response := db.conn.Cmd("GET", redisKey)
|
||||||
if response.IsType(redis.Nil) {
|
if response.IsType(redis.Nil) {
|
||||||
|
Loading…
Reference in New Issue
Block a user