Skip to content

Commit

Permalink
Merge PR #2472: Remove the message size restriction and fix the valid…
Browse files Browse the repository at this point in the history
…ation of images
  • Loading branch information
mkrautz committed Aug 28, 2016
2 parents 79f1885 + 3d082c8 commit 13772c1
Showing 1 changed file with 30 additions and 13 deletions.
43 changes: 30 additions & 13 deletions src/mumble/Log.cpp
Expand Up @@ -413,22 +413,39 @@ QString Log::validHtml(const QString &html, bool allowReplacement, QTextCursor *
} }
} }


if (!valid) {
QString errorImageMessage = tr("[[ No valid image ]]");
if (tc) {
tc->insertText(errorImageMessage);
return QString();
} else {
return errorImageMessage;
}
}

qtd.adjustSize(); qtd.adjustSize();
QSizeF s = qtd.size(); QSizeF s = qtd.size();


if (!valid || !s.isValid() || (s.width() > qr.width()) || (s.height() > qr.height())) { if (!s.isValid()) {
qtd.setPlainText(html); QString errorInvalidSizeMessage = tr("[[ Invalid size ]]");
qtd.adjustSize(); if (tc) {
s = qtd.size(); tc->insertText(errorInvalidSizeMessage);

return QString();
if (!s.isValid() || (s.width() > qr.width()) || (s.height() > qr.height())) { } else {
QString errorMessage = tr("[[ Text object too large to display ]]"); return errorInvalidSizeMessage;
if (tc) { }
tc->insertText(errorMessage); }
return QString();
} else { int messageSize = s.width() * s.height();
return errorMessage; int allowedSize = 2048 * 2048;
}
if (messageSize > allowedSize) {
QString errorSizeMessage = tr("[[ Text object too large to display ]]");
if (tc) {
tc->insertText(errorSizeMessage);
return QString();
} else {
return errorSizeMessage;
} }
} }


Expand Down

0 comments on commit 13772c1

Please sign in to comment.