From 20c9e0cab6485e6f68b186b267428e2ed5713047 Mon Sep 17 00:00:00 2001 From: alexia Date: Wed, 9 Aug 2023 16:31:41 +0200 Subject: [PATCH] fichier: fix error code parsing This fixes the following error I encountered: ``` 2023/08/09 16:18:49 DEBUG : failed parsing fichier error: strconv.Atoi: parsing "#374": invalid syntax 2023/08/09 16:18:49 DEBUG : pacer: low level retry 1/10 (error HTTP error 403 (403 Forbidden) returned body: "{\"status\":\"KO\",\"message\":\"Flood detected: IP Locked #374\"}") ``` --- backend/fichier/api.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/fichier/api.go b/backend/fichier/api.go index c0e3843dc..8e1bdbb61 100644 --- a/backend/fichier/api.go +++ b/backend/fichier/api.go @@ -28,14 +28,14 @@ var retryErrorCodes = []int{ 509, // Bandwidth Limit Exceeded } -var errorRegex = regexp.MustCompile(`#\d{1,3}`) +var errorRegex = regexp.MustCompile(`#(\d{1,3})`) func parseFichierError(err error) int { matches := errorRegex.FindStringSubmatch(err.Error()) if len(matches) == 0 { return 0 } - code, err := strconv.Atoi(matches[0]) + code, err := strconv.Atoi(matches[1]) if err != nil { fs.Debugf(nil, "failed parsing fichier error: %v", err) return 0