Skip to content

Commit

Permalink
chore: refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
robinbraemer committed Jul 12, 2023
1 parent 2632061 commit fa88222
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config-lite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ config:
- host: '*'
backend: 10.0.0.10:25565
fallback:
motd: §eThere is server for this host.
motd: §eNo server available for this host.
version:
name: §eTry example.com
protocol: -1
Expand Down
2 changes: 1 addition & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ config:
- host: '*'
backend: 10.0.0.10:25565
fallback:
motd: §eThere is server for this host.
motd: §eNo server available for this host.
version:
name: §eTry example.com
protocol: -1
Expand Down
7 changes: 5 additions & 2 deletions pkg/util/favicon/favicon.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,17 @@ func Parse(s string) (Favicon, error) {
if strings.HasPrefix(s, dataImagePrefix) {
return Favicon(s), nil
}
if stat, err := os.Stat(s); err == nil && !stat.IsDir() {
if stat, err := os.Stat(s); err == nil {
if stat.IsDir() {
return "", fmt.Errorf("favicon: %s is a directory not a file", s)
}
f, err := FromFile(s)
if err != nil {
return "", fmt.Errorf("favicon: %w", err)
}
return f, nil
}
return "", fmt.Errorf("favicon: invalid format or file not found: %s", s)
return "", fmt.Errorf("favicon: invalid format: %s", s)
}

// FromBytes takes base64 bytes encoding of an image and converts it to Favicon.
Expand Down

0 comments on commit fa88222

Please sign in to comment.