mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-10-30 17:40:47 +03:00
Fix thumbnails of received encrypted images
This commit is contained in:
parent
43a1975e16
commit
30ba387076
2 changed files with 8 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
Loading…
Reference in a new issue