package files import ( "os" "path" "strings" "elyby/minecraft-skinsystem/model" ) type filesDb struct { path string } 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 { return record, CapeNotFoundError{username} } record.File = file return record, nil }