Skip to content

Commit f5b4145

Browse files
committed
info: Don't show empty link when upload fails
pastebin can return an empty link instead of an exception when the upload fails. If the link is empty raise an exception. Also, fix the exception handling. There were one too many arguments in the notify-send call. We don't need to get the exact pastebin error here. It uses nc underneath which isn't relevant to the user. The actual error is displayed in the terminal if needed.
1 parent 0be7658 commit f5b4145

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • usr/lib/linuxmint/mintreport

usr/lib/linuxmint/mintreport/app.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,11 +522,13 @@ def upload_inxi_info(self, button):
522522
try:
523523
output = subprocess.check_output("pastebin %s" % TMP_INXI_FILE, shell=True).decode("UTF-8")
524524
link = output.rstrip('\x00').strip() # Remove ASCII null termination with \x00
525+
if not link:
526+
raise()
525527
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
526528
clipboard.set_text(link, -1)
527529
subprocess.Popen(['notify-send', '-i', 'xsi-dialog-information-symbolic', _("System information uploaded"), _("Your system information was uploaded to %s. This link was placed in your clipboard.") % link])
528-
except Exception as e:
529-
subprocess.Popen(['notify-send', '-i', 'xsi-dialog-error-symbolic', _("An error occurred while uploading the system information"), _("Copy and paste the system information manually into a pastebin site like https://pastebin.com."), str(e)])
530+
except Exception:
531+
subprocess.Popen(['notify-send', '-i', 'xsi-dialog-error-symbolic', _("An error occurred while uploading the system information"), _("Copy and paste the system information manually into a pastebin site like https://pastebin.com.")])
530532

531533
@xt.run_idle
532534
def add_report_to_treeview(self, report):

0 commit comments

Comments
 (0)