usmannasir / cyberpanel

Cyber Panel - The hosting control panel for OpenLiteSpeed
GNU General Public License v3.0
1.48k stars 577 forks source link

[BUG] cli/cyberPanel.py version is broken #1168

Open Lvl4Sword opened 7 months ago

Lvl4Sword commented 7 months ago

Describe the bug When trying to run cyberpanel version, the following error occurs:

Traceback (most recent call last):
  File "/usr/bin/cyberpanel", line 1603, in <module>
    main()
  File "/usr/bin/cyberpanel", line 1357, in main
    print(get_cyberpanel_version())
  File "/usr/bin/cyberpanel", line 35, in get_cyberpanel_version
    version = json.loads(str(version_file))
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 4)

To Reproduce What steps did you take when the issue occurred?

  1. Run cyberpanel version
  2. See the error

Expected behavior For there to not be an error

Operating system: Ubuntu 20.04 LTS

CyberPanel version: Version 2.3 / Build: 4 / Current Commit: https://github.com/usmannasir/cyberpanel/commit/c8da443334b8815ec250a0fba606e75355f641cd

Lvl4Sword commented 7 months ago

I'll do a commit in a bit, but the fix is

def get_cyberpanel_version():
    with open('/usr/local/CyberCP/version.txt') as version:
        version_file = version.read().split()
    return f"{version_file[0]}.{version_file[1]}"
usmannasir commented 5 months ago

This seems to be fixed.

Lvl4Sword commented 5 months ago

This doesn't appear to be completed

Lvl4Sword commented 5 months ago

@usmannasir What made you believe this was completed?

usmannasir commented 5 months ago

I can execute cyberpanel version on my end, you can not ?

master3395 commented 5 months ago

Works fine for me also in 2.3.5 - Almalinux 8.9