hopefully fixed 'missing.svg' in image results
This commit is contained in:
parent
ccba37021a
commit
01c48fd366
2 changed files with 12 additions and 2 deletions
12
images.go
12
images.go
|
@ -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
|
// Final debug print to show the count of results fetched
|
||||||
printInfo("Fetched %d image results for overall page %d", len(results), page)
|
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) {
|
func wrapImageSearchFunc(f func(string, string, string, int) ([]ImageSearchResult, time.Duration, error)) func(string, string, string, int) ([]SearchResult, time.Duration, error) {
|
||||||
|
|
|
@ -240,7 +240,7 @@
|
||||||
<script>
|
<script>
|
||||||
(function() {
|
(function() {
|
||||||
// Configuration
|
// Configuration
|
||||||
const imageStatusInterval = 1000; // Interval in milliseconds to check image status
|
const imageStatusInterval = 500; // Interval in milliseconds to check image status
|
||||||
const scrollThreshold = 500; // Distance from bottom of the page to trigger loading
|
const scrollThreshold = 500; // Distance from bottom of the page to trigger loading
|
||||||
let isFetching = false;
|
let isFetching = false;
|
||||||
let page = parseInt(document.getElementById('template-data').getAttribute('data-page')) || 1;
|
let page = parseInt(document.getElementById('template-data').getAttribute('data-page')) || 1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue