mirror of
https://github.com/minio/minio.git
synced 2025-11-09 13:39:46 -05:00
notifiers: Stop using url.Parse in validating address format. (#4011)
url.Parse() wrongly parses an address of format "address:port" which is fixed in go1.8. This inculcates a breaking change on our end. We should fix this wrong usage everywhere so that migrating to go1.8 eventually becomes smoother.
This commit is contained in:
@@ -266,13 +266,13 @@ func isFile(path string) bool {
|
||||
}
|
||||
|
||||
// checkURL - checks if passed address correspond
|
||||
func checkURL(address string) (*url.URL, error) {
|
||||
if address == "" {
|
||||
func checkURL(urlStr string) (*url.URL, error) {
|
||||
if urlStr == "" {
|
||||
return nil, errors.New("Address cannot be empty")
|
||||
}
|
||||
u, err := url.Parse(address)
|
||||
u, err := url.Parse(urlStr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("`%s` invalid: %s", address, err.Error())
|
||||
return nil, fmt.Errorf("`%s` invalid: %s", urlStr, err.Error())
|
||||
}
|
||||
return u, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user