Unify repo settings & show better error (#19828)
* Unify context data * Actually show invalid url in error
This commit is contained in:
parent
3898fc5bda
commit
edf14202fe
7 changed files with 18 additions and 14 deletions
|
@ -101,7 +101,7 @@ func ParseRemoteAddr(remoteAddr, authUsername, authPassword string) (string, err
|
|||
strings.HasPrefix(remoteAddr, "git://") {
|
||||
u, err := url.Parse(remoteAddr)
|
||||
if err != nil {
|
||||
return "", &models.ErrInvalidCloneAddr{IsURLError: true}
|
||||
return "", &models.ErrInvalidCloneAddr{IsURLError: true, Host: remoteAddr}
|
||||
}
|
||||
if len(authUsername)+len(authPassword) > 0 {
|
||||
u.User = url.UserPassword(authUsername, authPassword)
|
||||
|
|
|
@ -44,7 +44,7 @@ func IsMigrateURLAllowed(remoteURL string, doer *user_model.User) error {
|
|||
// Remote address can be HTTP/HTTPS/Git URL or local path.
|
||||
u, err := url.Parse(remoteURL)
|
||||
if err != nil {
|
||||
return &models.ErrInvalidCloneAddr{IsURLError: true}
|
||||
return &models.ErrInvalidCloneAddr{IsURLError: true, Host: remoteURL}
|
||||
}
|
||||
|
||||
if u.Scheme == "file" || u.Scheme == "" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue