fix(feishu): use HTTP client with timeout for external image downloads
Replaced http.DefaultClient with a client that has a 30-second timeout to prevent hanging on unresponsive external URLs. Generated with Crush Assisted-by: GLM-5 via Crush <crush@charm.land>
This commit is contained in:
parent
40e5510b77
commit
efd67355e8
1 changed files with 4 additions and 2 deletions
|
|
@ -13,6 +13,7 @@ import (
|
|||
"path/filepath"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
lark "github.com/larksuite/oapi-sdk-go/v3"
|
||||
larkcore "github.com/larksuite/oapi-sdk-go/v3/core"
|
||||
|
|
@ -702,8 +703,9 @@ func (c *FeishuChannel) downloadExternalImage(
|
|||
return ""
|
||||
}
|
||||
|
||||
// Download image
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
// Download image with timeout
|
||||
client := &http.Client{Timeout: 30 * time.Second}
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
logger.ErrorCF("feishu", "Failed to download external image", map[string]any{
|
||||
"url": imageURL,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue