fix(vikon): add file type validation and temp cleanup in UpdatePartAction

This commit is contained in:
F4ilji
2026-07-05 03:01:12 +05:00
parent 059705d60d
commit e8e36156e9
@@ -87,13 +87,22 @@ class UpdatePartAction
$zip->close();
File::delete($zipFile);
// Validate extracted file types
$blocked = $this->fs->validateFileTypes($tempPath);
if (!empty($blocked)) {
File::deleteDirectory($tempPath);
throw new \RuntimeException('Blocked files in ZIP: ' . implode(', ', $blocked));
}
$modulePath = $this->basePath . '/' . $config['path'];
// Step 5: Apply
$syncedCount = $this->applyPart($part, $tempPath, $modulePath, $moduleId, $config);
// Step 6: Clean temp
File::deleteDirectory($tempPath);
try {
// Step 5: Apply
$syncedCount = $this->applyPart($part, $tempPath, $modulePath, $moduleId, $config);
} finally {
// Step 6: Clean temp (always runs, even on exception)
File::deleteDirectory($tempPath);
}
Log::info('Vikon: part update complete', ['module' => $moduleId, 'part' => $part, 'synced' => $syncedCount]);