From 32a7442dba7fe289673962ab37ed3c893bdeaea6 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Wed, 5 Nov 2025 06:08:48 +0500 Subject: [PATCH] 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. --- install/installCyberPanel.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/install/installCyberPanel.py b/install/installCyberPanel.py index 6b193cd84..42b130bce 100644 --- a/install/installCyberPanel.py +++ b/install/installCyberPanel.py @@ -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) - InstallCyberPanel.stdOut(f"Downloaded successfully ({file_size / (1024*1024):.2f} MB)", 1) - return True + # 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(f"ERROR: Downloaded file too small ({file_size} bytes)", 1) + return False else: - InstallCyberPanel.stdOut("ERROR: Download failed", 1) + InstallCyberPanel.stdOut("ERROR: Download failed - file not found", 1) return False except Exception as msg: