Lower download size threshold to support smaller module files
Reduce minimum file size from 1MB to 10KB to allow the module file (~35KB) to pass validation. The 1MB threshold was too strict and only appropriate for the main OLS binary. Now displays size in KB or MB appropriately.
This commit is contained in:
parent
32a7442dba
commit
2952791761
|
|
@ -236,9 +236,12 @@ class InstallCyberPanel:
|
||||||
# Check if file was downloaded successfully by verifying it exists and has reasonable size
|
# Check if file was downloaded successfully by verifying it exists and has reasonable size
|
||||||
if os.path.exists(destination):
|
if os.path.exists(destination):
|
||||||
file_size = os.path.getsize(destination)
|
file_size = os.path.getsize(destination)
|
||||||
# Verify file size is reasonable (at least 1MB for a real binary)
|
# Verify file size is reasonable (at least 10KB to avoid error pages/empty files)
|
||||||
if file_size > 1048576: # 1MB
|
if file_size > 10240: # 10KB
|
||||||
InstallCyberPanel.stdOut(f"Downloaded successfully ({file_size / (1024*1024):.2f} MB)", 1)
|
if file_size > 1048576: # 1MB
|
||||||
|
InstallCyberPanel.stdOut(f"Downloaded successfully ({file_size / (1024*1024):.2f} MB)", 1)
|
||||||
|
else:
|
||||||
|
InstallCyberPanel.stdOut(f"Downloaded successfully ({file_size / 1024:.2f} KB)", 1)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
InstallCyberPanel.stdOut(f"ERROR: Downloaded file too small ({file_size} bytes)", 1)
|
InstallCyberPanel.stdOut(f"ERROR: Downloaded file too small ({file_size} bytes)", 1)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue