From 30ba3870766ebdae647c400e52cabc65c0806c19 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 22 Mar 2022 04:32:11 +0100 Subject: [PATCH] Fix thumbnails of received encrypted images --- src/MxcImageProvider.cpp | 8 +++++--- src/timeline/EventStore.cpp | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/MxcImageProvider.cpp b/src/MxcImageProvider.cpp index 6df5cd43..0a91dde3 100644 --- a/src/MxcImageProvider.cpp +++ b/src/MxcImageProvider.cpp @@ -65,9 +65,9 @@ MxcImageRunnable::run() MxcImageProvider::download( m_id, m_requestedSize, - [this](QString, QSize, QImage image, QString) { + [this](QString id, QSize, QImage image, QString) { if (image.isNull()) { - emit error(QStringLiteral("Failed to download image.")); + emit error(QStringLiteral("Failed to download image: %1").arg(id)); } else { emit done(image); } @@ -157,7 +157,6 @@ MxcImageProvider::download(const QString &id, mtx::http::RequestErr err) { if (err || res.empty()) { download(id, QSize(), then, crop, radius); - return; } @@ -237,6 +236,7 @@ MxcImageProvider::download(const QString &id, const std::string &originalFilename, mtx::http::RequestErr err) { if (err) { + nhlog::net()->error("Failed to download {}: {}", id.toStdString(), *err); then(id, QSize(), {}, QLatin1String("")); return; } @@ -244,6 +244,8 @@ MxcImageProvider::download(const QString &id, auto tempData = res; QFile f(fileInfo.absoluteFilePath()); if (!f.open(QIODevice::Truncate | QIODevice::WriteOnly)) { + nhlog::net()->error( + "Failed to write {}: {}", id.toStdString(), f.errorString().toStdString()); then(id, QSize(), {}, QLatin1String("")); return; } diff --git a/src/timeline/EventStore.cpp b/src/timeline/EventStore.cpp index 1293245c..867b9cd2 100644 --- a/src/timeline/EventStore.cpp +++ b/src/timeline/EventStore.cpp @@ -720,6 +720,9 @@ EventStore::decryptEvent(const IdIndex &idx, } auto encInfo = mtx::accessors::file(decryptionResult.event.value()); + if (encInfo) + emit newEncryptedImage(encInfo.value()); + encInfo = mtx::accessors::thumbnail_file(decryptionResult.event.value()); if (encInfo) emit newEncryptedImage(encInfo.value());