Explorar o código

HUE-7552 [fb] Copy Folder Into Itself Causes Endless Loop

Ying Chen %!s(int64=8) %!d(string=hai) anos
pai
achega
e6bce8a8a1
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      apps/filebrowser/src/filebrowser/views.py

+ 2 - 0
apps/filebrowser/src/filebrowser/views.py

@@ -1173,6 +1173,8 @@ def copy(request):
     params = ['src_path']
     def bulk_copy(*args, **kwargs):
         for arg in args:
+            if arg['src_path'] == arg['dest_path']:
+                raise PopupException(_('Source path and destination path cannot be same'))
             request.fs.copy(arg['src_path'], arg['dest_path'], recursive=True, owner=request.user)
     return generic_op(CopyFormSet, request, bulk_copy, ["src_path", "dest_path"], None,
                       data_extractor=formset_data_extractor(recurring, params),