fix: handle more errors in downloadImage()

This commit is contained in:
Yang Luo 2023-09-15 22:40:53 +08:00
parent ce7a2e924b
commit eacc3fae5a
2 changed files with 2 additions and 2 deletions

View File

@ -221,7 +221,7 @@ func GenerateCasToken(userId string, service string) (string, error) {
value = "" value = ""
} }
if v != "" { if value != "" {
authenticationSuccess.Attributes.UserAttributes.Attributes = append(authenticationSuccess.Attributes.UserAttributes.Attributes, &CasNamedAttribute{ authenticationSuccess.Attributes.UserAttributes.Attributes = append(authenticationSuccess.Attributes.UserAttributes.Attributes, &CasNamedAttribute{
Name: k, Name: k,
Value: value, Value: value,

View File

@ -35,7 +35,7 @@ func downloadImage(client *http.Client, url string) (*bytes.Buffer, string, erro
resp, err := client.Do(req) resp, err := client.Do(req)
if err != nil { if err != nil {
fmt.Printf("downloadImage() error for url [%s]: %s\n", url, err.Error()) fmt.Printf("downloadImage() error for url [%s]: %s\n", url, err.Error())
if strings.Contains(err.Error(), "EOF") || strings.Contains(err.Error(), "no such host") { if strings.Contains(err.Error(), "EOF") || strings.Contains(err.Error(), "no such host") || strings.Contains(err.Error(), "did not properly respond after a period of time") {
return nil, "", nil return nil, "", nil
} else { } else {
return nil, "", err return nil, "", err