Skip to content

Commit

Permalink
Addition fixed from #91
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-dk committed Sep 9, 2021
1 parent 60cf5a3 commit 3b20b4b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions tortoolkit/uploaders/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ async def execute(self):
password = self._update_message.client.dl_passwords.get(self._user_message.id)
if password is not None:
password = password[1]

start = time.time()
await self._update_message.edit(f"{self._update_message.text}\nTrying to Extract the archive with password: `{password}`")
wrong_pwd = False
Expand Down
8 changes: 7 additions & 1 deletion tortoolkit/utils/zip7_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ def get_size(start_path = '.'):
async def extract_archive(path, password=""):
if os.path.exists(path):
if os.path.isfile(path):
if str(path).endswith((".zip", "7z", "tar", "gzip2", "iso", "wim", "rar", "tar.gz","tar.bz2")):
valid_exts = (".zip", ".7z", ".tar", ".gzip2", ".iso", ".wim", ".rar", ".tar.gz",".tar.bz2")
if str(path).endswith(valid_exts):

# check userdata
userpath = os.path.join(os.getcwd(), "userdata")
if not os.path.exists(userpath):
Expand All @@ -120,6 +122,10 @@ async def extract_archive(path, password=""):
os.mkdir(extpath)

extpath = os.path.join(extpath,os.path.basename(path))
for i in valid_exts:
li = extpath.rsplit(i, 1)
extpath = "".join(li)

if not os.path.exists(extpath):
os.mkdir(extpath)

Expand Down

0 comments on commit 3b20b4b

Please sign in to comment.