From e8f632ae20cd4cc6f9619ba40a60bdcd185eb1b0 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 16 Nov 2024 12:55:47 -0500 Subject: [PATCH] Use the error message provided by the server's media endpoints This is usually more descriptive than what Qt gives us, like "remote media download failed" instead of an empty error message. --- Quotient/mxcreply.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Quotient/mxcreply.cpp b/Quotient/mxcreply.cpp index 77550fa19..45532f879 100644 --- a/Quotient/mxcreply.cpp +++ b/Quotient/mxcreply.cpp @@ -24,7 +24,10 @@ MxcReply::MxcReply(QNetworkReply* reply, connect(d->m_reply, &QNetworkReply::finished, this, [this, fileMetadata] { setError(d->m_reply->error(), d->m_reply->errorString()); - if (fileMetadata.isValid()) { + if (d->m_reply->error() != NoError) { + const QJsonDocument doc = QJsonDocument::fromJson(d->m_reply->readAll()); + setErrorString(QStringLiteral("%1 (%2)").arg(doc["error"_L1].toString(), d->m_reply->url().toString())); + } else if (fileMetadata.isValid()) { auto buffer = new QBuffer(this); buffer->setData(decryptFile(d->m_reply->readAll(), fileMetadata)); buffer->open(ReadOnly);