fix: playbook clone_from check playbook scope

This commit is contained in:
Bai
2026-06-16 17:09:22 +08:00
parent fc0d5e2d33
commit b0148ffadd

View File

@@ -66,6 +66,10 @@ class PlaybookViewSet(JMSBulkModelViewSet):
clone_id = self.request.query_params.get('clone_from')
if clone_id:
queryset = self.get_queryset()
clone_from = queryset.filter(id=clone_id).first()
if not clone_from:
raise JMSException(code='invalid_clone_id', detail={"msg": "Invalid clone_from id"})
src_path = safe_join(base_path, clone_id)
dest_path = safe_join(base_path, str(instance.id))
if not os.path.exists(src_path):