Browse Source

Remove redundant URL validation

DarthSim 6 years ago
parent
commit
597a8d52c2
1 changed files with 2 additions and 7 deletions
  1. 2 7
      download.go

+ 2 - 7
download.go

@@ -11,7 +11,6 @@ import (
 	"io"
 	"io"
 	"io/ioutil"
 	"io/ioutil"
 	"net/http"
 	"net/http"
-	"net/url"
 	"sync"
 	"sync"
 	"time"
 	"time"
 
 
@@ -136,13 +135,9 @@ func readAndCheckImage(ctx context.Context, res *http.Response) (context.Context
 }
 }
 
 
 func downloadImage(ctx context.Context) (context.Context, context.CancelFunc, error) {
 func downloadImage(ctx context.Context) (context.Context, context.CancelFunc, error) {
-	imageURL := fmt.Sprintf("%s%s", conf.BaseURL, getImageURL(ctx))
+	url := fmt.Sprintf("%s%s", conf.BaseURL, getImageURL(ctx))
 
 
-	if _, urlErr := url.ParseRequestURI(imageURL); urlErr != nil {
-		return ctx, func() {}, errInvalidImageURL
-	}
-
-	res, err := downloadClient.Get(imageURL)
+	res, err := downloadClient.Get(url)
 	if err != nil {
 	if err != nil {
 		return ctx, func() {}, err
 		return ctx, func() {}, err
 	}
 	}