upload plugin: Don’t insert invalid URL after HTTP upload failed.
This commit is contained in:
parent
aa3c4dea96
commit
507c45982d
1 changed files with 5 additions and 2 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue