Files
CyberPanel/install/safe-move-path
master3395 b6b0c1bf39 Fix File Manager: file deletion, special chars, upload auth (Root FM)
- Fix delete for domain and Root File Manager: use sudo helper when
  lscpd/executioner fails (TOKEN/sendCommand issues)
- Add safe-delete-path and safe-move-path helpers for base64 path handling
- Add ACLManager.isPathInsideHome and isFilePathSafeForShell for path validation
- Fix upload authorization for Root File Manager (domainName empty)
- Harden outputExecutioner result checks to prevent 500 on None
- Update Bootstrap CDN for CSP compatibility
- Improve error display and a11y focus management in modals
- Resolves #1670: files with special characters can be uploaded/deleted
2026-02-04 00:55:58 +01:00

25 lines
665 B
Python

#!/usr/bin/env python3
"""Helper script for CyberPanel File Manager: move src to dest by base64-encoded paths.
Invoked by lscpd as root. Exits 0 on success, 1 on failure."""
import sys
import os
import base64
import shutil
def main():
if len(sys.argv) < 3:
sys.exit(1)
try:
s_b64, d_b64 = sys.argv[1], sys.argv[2]
src = base64.b64decode(s_b64).decode('utf-8')
dest = base64.b64decode(d_b64).decode('utf-8')
if not src or not dest or not os.path.isabs(src):
sys.exit(1)
shutil.move(src, dest)
sys.exit(0)
except Exception:
sys.exit(1)
if __name__ == '__main__':
main()