From 3cff3287921a83d0c7ea271ee10a1bc3d2a4af9a Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Wed, 28 Oct 2026 11:22:00 -0700 Subject: [PATCH] Look for images in HTML when provided thumbnail fails or is too small. --- Mac/MainWindow/Timeline/TimelineViewController.swift | 9 +++++++++ iOS/MainTimeline/MainTimelineViewController.swift | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/Mac/MainWindow/Timeline/TimelineViewController.swift b/Mac/MainWindow/Timeline/TimelineViewController.swift index 516f1bf9a..b8b719307 100644 --- a/Mac/MainWindow/Timeline/TimelineViewController.swift +++ b/Mac/MainWindow/Timeline/TimelineViewController.swift @@ -801,7 +801,16 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr } // Articles that used the failed URL now get their next source, or none. let articleIDs = Set(thumbnailURLCache.filter { $0.value == url }.keys) + guard !articleIDs.isEmpty else { + return + } thumbnailURLsDidChange(for: articleIDs) + + // A failed provided image falls back to images in the HTML. + let articlesUsingURL = articles.filter { articleIDs.contains($0.articleID) } + Task { + await ArticleThumbnailFinder.shared.discoverThumbnailURLs(for: articlesUsingURL) + } } @objc nonisolated func handleUserDefaultsDidChange(_ notification: Notification) { diff --git a/iOS/MainTimeline/MainTimelineViewController.swift b/iOS/MainTimeline/MainTimelineViewController.swift index 621618bc6..18e4f897c 100644 --- a/iOS/MainTimeline/MainTimelineViewController.swift +++ b/iOS/MainTimeline/MainTimelineViewController.swift @@ -1281,7 +1281,18 @@ private extension MainTimelineViewController { } // Articles that used the failed URL now get their next source, or none. let articleIDs = Set(thumbnailURLCache.filter { $0.value == url }.keys) + guard !articleIDs.isEmpty else { + return + } thumbnailURLsDidChange(for: articleIDs) + + // A failed provided image falls back to images in the HTML. + guard let articlesUsingURL = articles?.filter({ articleIDs.contains($0.articleID) }) else { + return + } + Task { + await ArticleThumbnailFinder.shared.discoverThumbnailURLs(for: articlesUsingURL) + } } @objc func contentSizeCategoryDidChange(_ note: Notification) {