plugin upload: don't run available_cb if upload_jid is used in upload method

This commit is contained in:
Goffi 2021-05-06 18:11:33 +02:00
commit b6779cd0fd

View file

@ -80,7 +80,6 @@ class UploadPlugin(object):
@return (dict): action dictionary, with progress id in case of success, else xmlui
message
"""
try:
progress_id, __ = await self.upload(
client, filepath, filename, upload_jid, options)
@ -123,10 +122,11 @@ class UploadPlugin(object):
if not os.path.isfile(filepath):
raise exceptions.DataError("The given path doesn't link to a file")
for method_name, available_cb, upload_cb, priority in self._upload_callbacks:
try:
upload_jid = await available_cb(client, upload_jid)
except exceptions.NotFound:
continue # no entity managing this extension found
if upload_jid is None:
try:
upload_jid = await available_cb(client, upload_jid)
except exceptions.NotFound:
continue # no entity managing this extension found
log.info(
"{name} method will be used to upload the file".format(name=method_name)