From 1b1ae1145c18e46e748278a6e6848b30d3ac01be Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Thu, 9 Feb 2023 20:05:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=87=8D=E5=91=BD=E5=90=8D=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=89=8D=E6=A0=A1=E9=AA=8C=E6=98=AF=E5=90=A6=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E5=86=B2=E7=AA=81=20(#9488)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Aaron3S --- apps/ops/api/playbook.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/ops/api/playbook.py b/apps/ops/api/playbook.py index d25f2cb90..41edb0405 100644 --- a/apps/ops/api/playbook.py +++ b/apps/ops/api/playbook.py @@ -146,6 +146,8 @@ class PlaybookFileBrowserAPIView(APIView): if new_name: new_file_path = os.path.join(os.path.dirname(file_path), new_name) + if os.path.exists(new_file_path): + return Response({'msg': '{} already exists'.format(new_name)}, status=400) os.rename(file_path, new_file_path) file_path = new_file_path