Prevent deletion of system files

This commit is contained in:
2025-06-20 05:59:01 +02:00
parent bf9f1d2ffe
commit caa4142aa7
2 changed files with 10 additions and 0 deletions

View File

@ -6,6 +6,11 @@ $data = json_decode(file_get_contents('php://input'), true);
$oldV = $data['old'] ?? '';
$newName = $data['new'] ?? '';
if (strpos($oldV, '/.apps') === 0 || $oldV === '/.thos_state.json') {
echo json_encode(['success'=>false, 'error'=>'Cannot rename system files']);
exit;
}
$oldReal = resolve_path($oldV);
$newReal = dirname($oldReal) . '/' . basename($newName);