big b oys
This commit is contained in:
@@ -169,6 +169,13 @@ def validate_import_zip(zip_path: str) -> Tuple[bool, Optional[str]]:
|
||||
if not os.path.exists(zip_path):
|
||||
return False, "ZIP file not found"
|
||||
|
||||
# Check file size
|
||||
file_size = os.path.getsize(zip_path)
|
||||
print(f"Validating ZIP file: {zip_path}, size: {file_size} bytes")
|
||||
|
||||
if file_size == 0:
|
||||
return False, "ZIP file is empty"
|
||||
|
||||
# Try to open as ZIP
|
||||
try:
|
||||
with zipfile.ZipFile(zip_path, 'r') as zipf:
|
||||
@@ -214,12 +221,17 @@ def validate_import_zip(zip_path: str) -> Tuple[bool, Optional[str]]:
|
||||
|
||||
return True, None
|
||||
|
||||
except zipfile.BadZipFile:
|
||||
return False, "Invalid ZIP file format"
|
||||
except json.JSONDecodeError:
|
||||
return False, "Invalid JSON in manifest.json"
|
||||
except zipfile.BadZipFile as e:
|
||||
print(f"BadZipFile error: {e}")
|
||||
return False, f"Invalid ZIP file format: {str(e)}"
|
||||
except json.JSONDecodeError as e:
|
||||
print(f"JSON decode error: {e}")
|
||||
return False, f"Invalid JSON in manifest.json: {str(e)}"
|
||||
|
||||
except Exception as e:
|
||||
print(f"Unexpected validation error: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
return False, f"Validation error: {str(e)}"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user