mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-29 19:32:55 +00:00
fix: 重命名文件前校验是否存在冲突 (#9488)
Co-authored-by: Aaron3S <chenyang@fit2cloud.com>
This commit is contained in:
parent
e36a64ae2c
commit
1b1ae1145c
@ -146,6 +146,8 @@ class PlaybookFileBrowserAPIView(APIView):
|
|||||||
|
|
||||||
if new_name:
|
if new_name:
|
||||||
new_file_path = os.path.join(os.path.dirname(file_path), 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)
|
os.rename(file_path, new_file_path)
|
||||||
file_path = new_file_path
|
file_path = new_file_path
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user