upload plugin: Don’t insert invalid URL after HTTP upload failed.

This commit is contained in:
Emmanuel Gil Peyrot 2018-03-11 19:42:11 +01:00
parent aa3c4dea96
commit 507c45982d

View file

@ -17,6 +17,7 @@ This plugin adds a command to the chat tabs.
""" """
import asyncio import asyncio
import traceback
from os.path import expanduser from os.path import expanduser
from glob import glob from glob import glob
@ -41,8 +42,10 @@ class Plugin(BasePlugin):
def async_upload(self, filename): def async_upload(self, filename):
try: try:
url = yield from self.core.xmpp['xep_0363'].upload_file(filename) url = yield from self.core.xmpp['xep_0363'].upload_file(filename)
except Exception as e: except Exception:
self.api.information('Failed to upload the file: %s(%s)' % (type(e), e), 'Error') exception = traceback.format_exc()
self.api.information('Failed to upload file: %s' % exception, 'Error')
return
self.core.insert_input_text(url) self.core.insert_input_text(url)
@command_args_parser.quoted(1) @command_args_parser.quoted(1)