usmannasir / cyberpanel

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

[BUG] Deleting a subdomain may delete the whole public_html folder #1122

Open hadi060 opened 10 months ago

hadi060 commented 10 months ago

I've noticed two issues with subdomains in CyberPanel: 1- If you create a subdomain and its path is public_html, CyberPanel will not create a directory for it inside the public_html folder. Instead, it will only create an index.html file in the main public_html folder. This is a problem because if you delete this subdomain and choose to delete its root folder, the entire public_html folder will be deleted. 2- If you have an old subdomain directory that is inside the public_html folder (this was possible before), and you delete this subdomain and its folder, CyberPanel will delete the entire public_html folder. This means that all of your files will be lost.

To Reproduce

  1. Create a subdomain and put "public_html" as its path;
  2. Delete that subdomain.
  3. The "public_html" folder is deleted.

Expected behavior

  1. CyberPanel should create the subdomain inside public_html folder.
  2. CyberPanel shouldn't delete the public_html folder when deleting that subdomain with its root folder.

Operating system: Ubuntu 20.04 LTS

CyberPanel version: 2.3.4