From d23bcbd956ad28423bf2e8a88e90389e389a4744 Mon Sep 17 00:00:00 2001
From: Anas <77075674+anasty17@users.noreply.github.com>
Date: Sat, 5 Jun 2021 07:02:12 +0300
Subject: [PATCH] Fix count after upload while index link is none (#131)
---
bot/modules/mirror.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 606ab0a9109..c69dee9e690 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -149,6 +149,12 @@ def onUploadProgress(self):
def onUploadComplete(self, link: str, size, files, folders, typ):
with download_dict_lock:
msg = f'Filename: {download_dict[self.uid].name()}
\nSize: {size}
'
+ if os.path.isdir(f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}'):
+ msg += '\n\nType: Folder'
+ msg += f'\nSubFolders: {folders}'
+ msg += f'\nFiles: {files}'
+ else:
+ msg += f'\n\nType: {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 @@ def onUploadComplete(self, link: str, size, files, folders, typ):
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\nType: Folder'
- msg += f'\nSubFolders: {folders}'
- msg += f'\nFiles: {files}'
- else:
- msg += f'\n\nType: {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)