fixes thumbnail bug

This commit is contained in:
Christian Beutel
2025-03-16 18:39:48 +01:00
parent cea666ecc6
commit 92433ec618
3 changed files with 18 additions and 11 deletions

View File

@@ -12,7 +12,11 @@ func documentFromTrailRecord(r *models.Record, author *models.Record, includeSha
photos := r.GetStringSlice("photos")
thumbnail := ""
if len(photos) > 0 {
thumbnail = r.GetStringSlice("photos")[r.GetInt("thumbnail")]
thumbnailIndex := r.GetInt("thumbnail")
if thumbnailIndex >= len(photos) {
thumbnailIndex = 0
}
thumbnail = photos[thumbnailIndex]
}
document := map[string]interface{}{