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();
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;
}
}

Expand Down

0 comments on commit 13772c1

Please sign in to comment.