mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 Data sync connectivity check supports redirection Fix https://github.com/siyuan-note/siyuan/issues/8264
This commit is contained in:
parent
d24f5ae3cf
commit
516276db49
2 changed files with 14 additions and 2 deletions
|
|
@ -139,7 +139,7 @@ func BootSyncData() {
|
|||
|
||||
if !isProviderOnline(false) {
|
||||
BootSyncSucc = 1
|
||||
util.PushErrMsg(Conf.Language(28), 7000)
|
||||
util.PushErrMsg(Conf.Language(76), 7000)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,19 @@ func isOnline(checkURL string, skipTlsVerify bool) (ret bool) {
|
|||
}
|
||||
|
||||
for i := 0; i < 3; i++ {
|
||||
_, err := c.R().Get(checkURL)
|
||||
resp, err := c.R().Get(checkURL)
|
||||
if resp.GetHeader("Location") != "" {
|
||||
return true
|
||||
}
|
||||
|
||||
switch err.(type) {
|
||||
case *url.Error:
|
||||
if err.(*url.Error).URL != checkURL {
|
||||
// DNS 重定向
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
ret = nil == err
|
||||
if ret {
|
||||
break
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue