Skip to content

Commit

Permalink
Merge #832(redstrate): Use the error message provided by the server's…
Browse files Browse the repository at this point in the history
… media endpoints
  • Loading branch information
KitsuneRal authored Nov 16, 2024
2 parents 4999cf7 + e8f632a commit 2092ebc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Quotient/mxcreply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2092ebc

Please sign in to comment.