From c526bb433951ebbc4312be928f447d7bdc2737e1 Mon Sep 17 00:00:00 2001 From: Anton Voskresenskij <34609259+perhamm@users.noreply.github.com> Date: Thu, 30 Oct 2025 08:02:50 +0300 Subject: [PATCH] fix snapshot without date in name --- modules/router/router.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/router/router.go b/modules/router/router.go index 2999731..f04f700 100644 --- a/modules/router/router.go +++ b/modules/router/router.go @@ -378,6 +378,10 @@ func (rt *Router) ApiHandler(w http.ResponseWriter, r *http.Request) { } if !matched { match := re.FindStringSubmatch(n.Snapshot) + if len(match) < 3 { + log.Println("Skip snapshot with unexpected name:", n.Snapshot) + continue + } n.CreateDate = match[2] d, err := time.Parse("2006.01.02", n.CreateDate) n.CreateEpoch = d.Unix() @@ -392,6 +396,10 @@ func (rt *Router) ApiHandler(w http.ResponseWriter, r *http.Request) { } else { for _, n := range snap_resp.Snapshots { match := re.FindStringSubmatch(n.Snapshot) + if len(match) < 3 { + log.Println("Skip snapshot with unexpected name:", n.Snapshot) + continue + } n.CreateDate = match[2] d, err := time.Parse("2006.01.02", n.CreateDate) n.CreateEpoch = d.Unix()