mirror of
https://github.com/oneclickvirt/backtrace.git
synced 2026-11-24 23:39:41 +08:00
fix:修复panic恢复机制
This commit is contained in:
1 parent
026f9784e4
commit
ce8555f149
11 files changed
+94
-21
No files matched your search
+6
-2
@@ -117,7 +117,10 @@ func getSVGPath(ip string) (string, error) {
|
||||
client := req.C().ImpersonateChrome()
|
||||
url := fmt.Sprintf("https://bgp.tools/prefix/%s#connectivity", ip)
|
||||
resp, err := executeWithRetry(client, url, defaultRetryConfig)
|
||||
if err == nil {
|
||||
if err == nil && resp != nil {
|
||||
if resp.Body != nil {
|
||||
defer resp.Body.Close()
|
||||
}
|
||||
body := resp.String()
|
||||
re := regexp.MustCompile(`<img[^>]+id="pathimg"[^>]+src="([^"]+)"`)
|
||||
matches := re.FindStringSubmatch(body)
|
||||
@@ -142,7 +145,8 @@ func downloadSVG(svgPath string) (string, error) {
|
||||
uuid := uuid.NewString()
|
||||
url := fmt.Sprintf("https://bgp.tools%s?%s&loggedin", svgPath, uuid)
|
||||
resp, err := executeWithRetry(client, url, defaultRetryConfig)
|
||||
if err == nil {
|
||||
if err == nil && resp != nil && resp.Body != nil {
|
||||
defer resp.Body.Close()
|
||||
bodyBytes, err := io.ReadAll(resp.Body)
|
||||
if err == nil {
|
||||
return string(bodyBytes), nil
|
||||
|
||||
Reference in new issue
Block a user