11import os
22from shutil import rmtree , copytree
33from sys import argv
4- from zipfile import ZipFile
4+ from zipfile import ZipFile , BadZipFile
55
66import requests
77from PyQt5 .QtGui import QDesktopServices , QColor , QBrush , QIcon
@@ -392,7 +392,7 @@ def start_next_download():
392392 file_url = f"{ 'https://stlunlocker.pro/unlocker/' } { dlc_folder } .zip"
393393 save_path = os .path .join (self .game_path , 'dlc' , f'{ dlc_folder } .zip' )
394394 dlc_path = os .path .join (self .game_path , 'dlc' , dlc_folder )
395-
395+
396396 if not os .path .exists (dlc_path ) and self .is_invalid_zip (save_path ):
397397 if os .path .exists (save_path ):
398398 os .remove (save_path )
@@ -413,17 +413,17 @@ def update_creamapi_progress(self, value):
413413
414414 @staticmethod
415415 def is_invalid_zip (path ):
416- if not os .path .exists (path ):
417- return True
418- if os .path .getsize (path ) == 0 :
419- return True
420- try :
421- with zipfile . ZipFile (path , 'r' ) as zf :
422- if zf .testzip () is not None :
423- return True # Corrupted file found
424- except zipfile . BadZipFile :
425- return True # Not even a zip
426- return False
416+ if not os .path .exists (path ):
417+ return True
418+ if os .path .getsize (path ) == 0 :
419+ return True
420+ try :
421+ with ZipFile (path , 'r' ) as zf :
422+ if zf .testzip () is not None :
423+ return True # Corrupted file found
424+ except BadZipFile :
425+ return True # Not even a zip
426+ return False
427427
428428 def update_progress (self , value , by_download = False ):
429429 self .dlc_download_progress_bar .setValue (value )
0 commit comments