diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2022-05-02 12:02:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-02 12:02:17 +0800 |
commit | 71bafa0263757367317f031b3b633a8d437d735c (patch) | |
tree | 18bfeefb0e174cfc9ed233398bd033e38193d3db | |
parent | 05234adfa80f220520e0fca7d496b7c0d1584ffa (diff) | |
download | gitea-71bafa0263757367317f031b3b633a8d437d735c.tar.gz gitea-71bafa0263757367317f031b3b633a8d437d735c.zip |
ignore DNS error when doing migration allow/block check (#19566)
Co-authored-by: 6543 <6543@obermui.de>
-rw-r--r-- | models/error.go | 4 | ||||
-rw-r--r-- | services/migrations/migrate.go | 7 |
2 files changed, 3 insertions, 8 deletions
diff --git a/models/error.go b/models/error.go index 6846bf8320..c29c818589 100644 --- a/models/error.go +++ b/models/error.go @@ -296,7 +296,6 @@ type ErrInvalidCloneAddr struct { IsProtocolInvalid bool IsPermissionDenied bool LocalPath bool - NotResolvedIP bool } // IsErrInvalidCloneAddr checks if an error is a ErrInvalidCloneAddr. @@ -306,9 +305,6 @@ func IsErrInvalidCloneAddr(err error) bool { } func (err *ErrInvalidCloneAddr) Error() string { - if err.NotResolvedIP { - return fmt.Sprintf("migration/cloning from '%s' is not allowed: unknown hostname", err.Host) - } if err.IsInvalidPath { return fmt.Sprintf("migration/cloning from '%s' is not allowed: the provided path is invalid", err.Host) } diff --git a/services/migrations/migrate.go b/services/migrations/migrate.go index b550be4ce7..700f06af35 100644 --- a/services/migrations/migrate.go +++ b/services/migrations/migrate.go @@ -81,10 +81,9 @@ func IsMigrateURLAllowed(remoteURL string, doer *user_model.User) error { err = nil //nolint hostName = u.Host } - addrList, err := net.LookupIP(hostName) - if err != nil { - return &models.ErrInvalidCloneAddr{Host: u.Host, NotResolvedIP: true} - } + + // some users only use proxy, there is no DNS resolver. it's safe to ignore the LookupIP error + addrList, _ := net.LookupIP(hostName) var ipAllowed bool var ipBlocked bool |