An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:recycle: Code style: type assertion or type switch on errors fails on wrapped errors (#17304)
Jeffrey Chenfb263abdedc8
diff --git a/kernel/util/net.go b/kernel/util/net.goindex ed94a780ac..33e84650cd 100644--- a/kernel/util/net.go+++ b/kernel/util/net.go@@ -17,6 +17,7 @@package utilimport (+ "errors""fmt""net""net/http"@@ -169,13 +170,11 @@ func isOnline(checkURL string, skipTlsVerify bool, timeout int) (ret bool) {return true}- switch err.(type) {- case *url.Error:- if err.(*url.Error).URL != checkURL {- // DNS 重定向- logging.LogWarnf("network is online [DNS redirect, checkURL=%s, retURL=%s]", checkURL, err.(*url.Error).URL)- return true- }+ var urlErr *url.Error+ if errors.As(err, &urlErr) && urlErr.URL != checkURL {+ // DNS 重定向+ logging.LogWarnf("network is online [DNS redirect, checkURL=%s, retURL=%s]", checkURL, urlErr.URL)+ return true}ret = err == nil