From 507c45982de834fa584e609d87079b3bda83faf5 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 11 Mar 2018 19:42:11 +0100 Subject: =?UTF-8?q?upload=20plugin:=20Don=E2=80=99t=20insert=20invalid=20U?= =?UTF-8?q?RL=20after=20HTTP=20upload=20failed.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/upload.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/upload.py b/plugins/upload.py index bfdbe47b..0f9ef736 100644 --- a/plugins/upload.py +++ b/plugins/upload.py @@ -17,6 +17,7 @@ This plugin adds a command to the chat tabs. """ import asyncio +import traceback from os.path import expanduser from glob import glob @@ -41,8 +42,10 @@ class Plugin(BasePlugin): def async_upload(self, filename): try: url = yield from self.core.xmpp['xep_0363'].upload_file(filename) - except Exception as e: - self.api.information('Failed to upload the file: %s(%s)' % (type(e), e), 'Error') + except Exception: + exception = traceback.format_exc() + self.api.information('Failed to upload file: %s' % exception, 'Error') + return self.core.insert_input_text(url) @command_args_parser.quoted(1) -- cgit v1.2.3