mirror of
https://github.com/elyby/chrly.git
synced 2025-05-31 14:11:51 +05:30
Реорганизация пакета daemon в http.
Упразднён пакет utils. Удалён обработчик minecraft.php (legacy с самого-самого начала Ely.by) Добавлены тесты для всех api-запросов.
This commit is contained in:
@@ -5,8 +5,8 @@ import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"elyby/minecraft-skinsystem/model"
|
||||
"elyby/minecraft-skinsystem/interfaces"
|
||||
"elyby/minecraft-skinsystem/model"
|
||||
)
|
||||
|
||||
type FilesystemFactory struct {
|
||||
@@ -42,19 +42,18 @@ type filesStorage struct {
|
||||
path string
|
||||
}
|
||||
|
||||
func (repository *filesStorage) FindByUsername(username string) (model.Cape, error) {
|
||||
var record model.Cape
|
||||
func (repository *filesStorage) FindByUsername(username string) (*model.Cape, error) {
|
||||
if username == "" {
|
||||
return record, &CapeNotFoundError{username}
|
||||
return nil, &CapeNotFoundError{username}
|
||||
}
|
||||
|
||||
capePath := path.Join(repository.path, strings.ToLower(username) + ".png")
|
||||
file, err := os.Open(capePath)
|
||||
if err != nil {
|
||||
return record, &CapeNotFoundError{username}
|
||||
return nil, &CapeNotFoundError{username}
|
||||
}
|
||||
|
||||
record.File = file
|
||||
|
||||
return record, nil
|
||||
return &model.Cape{
|
||||
File: file,
|
||||
}, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user