Skip to content

Commit

Permalink
Improve url detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Guasch committed Jul 10, 2017
1 parent e9c88c8 commit e121a8f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cmd/asciize/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ func main() {
a := asciize.NewAsciizer(opts...)

var m image.Image
var err error

// We check if it is a URL
switch _, err = url.ParseRequestURI(src); err {
case nil:
u, err := url.ParseRequestURI(src)
if err == nil && u.Host != "" {
m, err = imageFromURL(src)
default:
} else {
m, err = imageFromFile(src)
}

Expand Down

0 comments on commit e121a8f

Please sign in to comment.