diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c83a6d12..4fe5982c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ - Bugfix: Fixed existing emote popups not being raised from behind other windows when refocusing them on macOS (#3713) - Bugfix: Fixed automod queue pubsub topic persisting after user change. (#3718) - Bugfix: Fixed viewer list not closing after pressing escape key. (#3734) +- Bugfix: Fixed links with no thumbnail having previous link's thumbnail. (#3720) - Dev: Use Game Name returned by Get Streams instead of querying it from the Get Games API. (#3662) ## 2.3.5 diff --git a/src/providers/LinkResolver.cpp b/src/providers/LinkResolver.cpp index 41f511eb5..b0d8f5a93 100644 --- a/src/providers/LinkResolver.cpp +++ b/src/providers/LinkResolver.cpp @@ -26,32 +26,36 @@ void LinkResolver::getLinkInfo( QUrl::toPercentEncoding(url, "", "/:")))) .caller(caller) .timeout(30000) - .onSuccess( - [successCallback, url](NetworkResult result) mutable -> Outcome { - auto root = result.parseJson(); - auto statusCode = root.value("status").toInt(); - QString response = QString(); - QString linkString = url; - ImagePtr thumbnail = nullptr; - if (statusCode == 200) + .onSuccess([successCallback, + url](NetworkResult result) mutable -> Outcome { + auto root = result.parseJson(); + auto statusCode = root.value("status").toInt(); + QString response; + QString linkString = url; + ImagePtr thumbnail = nullptr; + if (statusCode == 200) + { + response = root.value("tooltip").toString(); + + if (root.contains("thumbnail")) { - response = root.value("tooltip").toString(); thumbnail = Image::fromUrl({root.value("thumbnail").toString()}); - if (getSettings()->unshortLinks) - { - linkString = root.value("link").toString(); - } } - else + if (getSettings()->unshortLinks) { - response = root.value("message").toString(); + linkString = root.value("link").toString(); } - successCallback(QUrl::fromPercentEncoding(response.toUtf8()), - Link(Link::Url, linkString), thumbnail); + } + else + { + response = root.value("message").toString(); + } + successCallback(QUrl::fromPercentEncoding(response.toUtf8()), + Link(Link::Url, linkString), thumbnail); - return Success; - }) + return Success; + }) .onError([successCallback, url](auto /*result*/) { successCallback("No link info found", Link(Link::Url, url), nullptr);