Skip to content
Permalink
Browse files

Merge PR #2472: Remove the message size restriction and fix the valid…

…ation of images
  • Loading branch information...
mkrautz committed Aug 28, 2016
2 parents 79f1885 + 3d082c8 commit 13772c1337a0a7dbed49d21f631449e746993d07
Showing with 30 additions and 13 deletions.
  1. +30 −13 src/mumble/Log.cpp
@@ -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();
QSizeF s = qtd.size();

if (!valid || !s.isValid() || (s.width() > qr.width()) || (s.height() > qr.height())) {
qtd.setPlainText(html);
qtd.adjustSize();
s = qtd.size();

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

int messageSize = s.width() * s.height();
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;
}
}

0 comments on commit 13772c1

Please sign in to comment.
You can’t perform that action at this time.