Fix count after upload while index link is none (#131)

This commit is contained in:
Anas 2021-06-05 07:02:12 +03:00 committed by GitHub
parent b709b8e130
commit d23bcbd956
Signed by untrusted user: GitHub
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,6 +149,12 @@ class MirrorListener(listeners.MirrorListeners):
def onUploadComplete(self, link: str, size, files, folders, typ):
with download_dict_lock:
msg = f'<b>Filename: </b><code>{download_dict[self.uid].name()}</code>\n<b>Size: </b><code>{size}</code>'
if os.path.isdir(f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}'):
msg += '\n\n<b>Type: </b>Folder'
msg += f'\n<b>SubFolders: </b>{folders}'
msg += f'\n<b>Files: </b>{files}'
else:
msg += f'\n\n<b>Type: </b>{typ}'
buttons = button_build.ButtonMaker()
if SHORTENER is not None and SHORTENER_API is not None:
surl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, link)).text
@ -161,11 +167,6 @@ class MirrorListener(listeners.MirrorListeners):
share_url = f'{INDEX_URL}/{url_path}'
if os.path.isdir(f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}'):
share_url += '/'
msg += '\n\n<b>Type: </b>Folder'
msg += f'\n<b>SubFolders: </b>{folders}'
msg += f'\n<b>Files: </b>{files}'
else:
msg += f'\n\n<b>Type: </b>{typ}'
if SHORTENER is not None and SHORTENER_API is not None:
siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, share_url)).text
buttons.buildbutton("⚡Index Link⚡", siurl)