Skip to content

Commit e121a8f

Browse files
author
Marc Guasch
committed
Improve url detection
1 parent e9c88c8 commit e121a8f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

cmd/asciize/main.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,11 @@ func main() {
2626
a := asciize.NewAsciizer(opts...)
2727

2828
var m image.Image
29-
var err error
30-
3129
// We check if it is a URL
32-
switch _, err = url.ParseRequestURI(src); err {
33-
case nil:
30+
u, err := url.ParseRequestURI(src)
31+
if err == nil && u.Host != "" {
3432
m, err = imageFromURL(src)
35-
default:
33+
} else {
3634
m, err = imageFromFile(src)
3735
}
3836

0 commit comments

Comments
 (0)