hopefully fixed 'missing.svg' in image results

This commit is contained in:
partisan 2024-11-13 17:49:02 +01:00
parent ccba37021a
commit 01c48fd366
2 changed files with 12 additions and 2 deletions

View file

@ -217,10 +217,20 @@ func fetchImageResults(query, safe, lang string, page int, synchronous bool) []I
}
}
// Filter out images that failed to cache or are invalid
validResults := make([]ImageSearchResult, 0, len(results))
for _, imageResult := range results {
if imageResult.ProxyFull != "" {
validResults = append(validResults, imageResult)
} else {
printWarn("Skipping invalid image with ID %s", imageResult.ID)
}
}
// Final debug print to show the count of results fetched
printInfo("Fetched %d image results for overall page %d", len(results), page)
return results
return validResults
}
func wrapImageSearchFunc(f func(string, string, string, int) ([]ImageSearchResult, time.Duration, error)) func(string, string, string, int) ([]SearchResult, time.Duration, error) {