Skip to content

Commit 35a7db4

Browse files
wxiaoguanglafriks
andauthored
ignore DNS error when doing migration allow/block check (#19567)
Co-authored-by: Lauris BH <[email protected]>
1 parent f4729e2 commit 35a7db4

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

models/error.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ type ErrInvalidCloneAddr struct {
332332
IsProtocolInvalid bool
333333
IsPermissionDenied bool
334334
LocalPath bool
335-
NotResolvedIP bool
336335
}
337336

338337
// IsErrInvalidCloneAddr checks if an error is a ErrInvalidCloneAddr.
@@ -342,9 +341,6 @@ func IsErrInvalidCloneAddr(err error) bool {
342341
}
343342

344343
func (err *ErrInvalidCloneAddr) Error() string {
345-
if err.NotResolvedIP {
346-
return fmt.Sprintf("migration/cloning from '%s' is not allowed: unknown hostname", err.Host)
347-
}
348344
if err.IsInvalidPath {
349345
return fmt.Sprintf("migration/cloning from '%s' is not allowed: the provided path is invalid", err.Host)
350346
}

services/migrations/migrate.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,9 @@ func IsMigrateURLAllowed(remoteURL string, doer *user_model.User) error {
8181
err = nil //nolint
8282
hostName = u.Host
8383
}
84-
addrList, err := net.LookupIP(hostName)
85-
if err != nil {
86-
return &models.ErrInvalidCloneAddr{Host: u.Host, NotResolvedIP: true}
87-
}
84+
85+
// some users only use proxy, there is no DNS resolver. it's safe to ignore the LookupIP error
86+
addrList, _ := net.LookupIP(hostName)
8887

8988
var ipAllowed bool
9089
var ipBlocked bool

0 commit comments

Comments
 (0)