mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-13 00:36:10 +01:00
Fix download verification logic for custom OLS binaries
Change download verification to check file existence and size instead of relying on return code. The wget command succeeds but install_utils.call() may not return 0. Now verifies downloaded file exists and is at least 1MB.
This commit is contained in:
@@ -231,14 +231,20 @@ class InstallCyberPanel:
|
||||
|
||||
# Use wget for better progress display
|
||||
command = f'wget -q --show-progress {url} -O {destination}'
|
||||
result = install_utils.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||
install_utils.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||
|
||||
if result == 0 and os.path.exists(destination):
|
||||
# Check if file was downloaded successfully by verifying it exists and has reasonable size
|
||||
if os.path.exists(destination):
|
||||
file_size = os.path.getsize(destination)
|
||||
# Verify file size is reasonable (at least 1MB for a real binary)
|
||||
if file_size > 1048576: # 1MB
|
||||
InstallCyberPanel.stdOut(f"Downloaded successfully ({file_size / (1024*1024):.2f} MB)", 1)
|
||||
return True
|
||||
else:
|
||||
InstallCyberPanel.stdOut("ERROR: Download failed", 1)
|
||||
InstallCyberPanel.stdOut(f"ERROR: Downloaded file too small ({file_size} bytes)", 1)
|
||||
return False
|
||||
else:
|
||||
InstallCyberPanel.stdOut("ERROR: Download failed - file not found", 1)
|
||||
return False
|
||||
|
||||
except Exception as msg:
|
||||
|
||||
Reference in New Issue
Block a user