strip uri query args from error message

This commit is contained in:
rick olson 2017-09-26 12:35:31 -06:00
parent d90abd95f8
commit c486c343c5
2 changed files with 5 additions and 2 deletions

@ -46,7 +46,8 @@ func (c *Client) NewRequest(method string, e Endpoint, suffix string, body inter
}
if !httpRE.MatchString(prefix) {
return nil, fmt.Errorf("missing protocol: %q", prefix)
urlfragment := strings.SplitN(prefix, "?", 2)[0]
return nil, fmt.Errorf("missing protocol: %q", urlfragment)
}
req, err := http.NewRequest(method, joinURL(prefix, suffix), nil)

@ -4,6 +4,7 @@ import (
"fmt"
"net/http"
"regexp"
"strings"
"sync"
"github.com/git-lfs/git-lfs/lfsapi"
@ -190,7 +191,8 @@ var httpRE = regexp.MustCompile(`\Ahttps?://`)
func (a *adapterBase) newHTTPRequest(method string, rel *Action) (*http.Request, error) {
if !httpRE.MatchString(rel.Href) {
return nil, fmt.Errorf("missing protocol: %q", rel.Href)
urlfragment := strings.SplitN(rel.Href, "?", 2)[0]
return nil, fmt.Errorf("missing protocol: %q", urlfragment)
}
req, err := http.NewRequest(method, rel.Href, nil)