From 86c94a5ce214f63694c077cc13cb8375e5208f2c Mon Sep 17 00:00:00 2001 From: slothful-vassal <89943360+slothful-vassal@users.noreply.github.com> Date: Mon, 27 Apr 2026 16:17:00 +0200 Subject: [PATCH] fix komoot integration issue with 'invalid' photos (#941) --- db/integrations/komoot/komoot.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/db/integrations/komoot/komoot.go b/db/integrations/komoot/komoot.go index 4547778b..65f8bebd 100644 --- a/db/integrations/komoot/komoot.go +++ b/db/integrations/komoot/komoot.go @@ -405,9 +405,9 @@ func fetchRoutePhotos(k *KomootApi, tour *DetailedKomootTour) ([]*filesystem.Fil return nil, err } - photos := make([]*filesystem.File, data.Page.TotalElements) + photos := make([]*filesystem.File, 0, len(data.Embedded.Items)) - for i, img := range data.Embedded.Items { + for _, img := range data.Embedded.Items { photo, err := fetchPhoto(img.Src, "", "") if err != nil { return nil, err @@ -415,7 +415,7 @@ func fetchRoutePhotos(k *KomootApi, tour *DetailedKomootTour) ([]*filesystem.Fil if strings.HasSuffix(photo.Name, ".gif") { continue } - photos[i] = photo + photos = append(photos, photo) //TODO: komoot photos can have location data. Maybe we should create a waypoint for those photos? } @@ -425,9 +425,9 @@ func fetchRoutePhotos(k *KomootApi, tour *DetailedKomootTour) ([]*filesystem.Fil func fetchWaypointPhotos(wp Item) ([]*filesystem.File, error) { - photos := make([]*filesystem.File, len(wp.Embedded.Reference.Embedded.Images.Embedded.Items)) + photos := make([]*filesystem.File, 0, len(wp.Embedded.Reference.Embedded.Images.Embedded.Items)) - for i, img := range wp.Embedded.Reference.Embedded.Images.Embedded.Items { + for _, img := range wp.Embedded.Reference.Embedded.Images.Embedded.Items { photo, err := fetchPhoto(img.Src, "", "") if err != nil { return nil, err @@ -435,7 +435,7 @@ func fetchWaypointPhotos(wp Item) ([]*filesystem.File, error) { if strings.HasSuffix(photo.Name, ".gif") { continue } - photos[i] = photo + photos = append(photos, photo) } return photos, nil