error: Set a cap on error dialog text size

Otherwise we can get some crazy sized dialogs with errors from
libvirt

https://bugzilla.redhat.com/show_bug.cgi?id=1786873

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2020-01-14 12:36:04 -05:00
parent b1b9e4b688
commit a9cbc4e583

View File

@ -15,6 +15,11 @@ from .baseclass import vmmGObject
def _launch_dialog(dialog, primary_text, secondary_text, title,
widget=None, modal=True):
if primary_text and len(primary_text) > 512:
primary_text = primary_text[:512] + "..."
if secondary_text and len(secondary_text) > 512:
secondary_text = secondary_text[:512] + "..."
dialog.set_property("text", primary_text)
dialog.format_secondary_text(secondary_text or None)
dialog.set_title(title)