Browse Source

Fix webdav move bug

Bastien Sevajol (Algoo) 8 years ago
parent
commit
8df5a406a7
1 changed files with 15 additions and 3 deletions
  1. 15 3
      tracim/tracim/lib/webdav/sql_resources.py

+ 15 - 3
tracim/tracim/lib/webdav/sql_resources.py View File

@@ -964,13 +964,25 @@ class File(DAVNonCollection):
964 964
                 self.content.file_extension = new_file_extension
965 965
                 self.content_api.save(self.content)
966 966
             else:
967
-                # TODO: ???le new parent ne peut être le parent actuel ?
967
+                workspace_api = WorkspaceApi(self.user)
968
+                content_api = ContentApi(self.user)
969
+
970
+                destination_workspace = self.provider.get_workspace_from_path(
971
+                    destpath,
972
+                    workspace_api,
973
+                )
974
+
975
+                destination_parent = self.provider.get_parent_from_path(
976
+                    destpath,
977
+                    content_api,
978
+                    workspace,
979
+                )
968 980
 
969 981
                 self.content_api.move(
970 982
                     item=self.content,
971
-                    new_parent=parent,
983
+                    new_parent=destination_parent,
972 984
                     must_stay_in_same_workspace=False,
973
-                    new_workspace=workspace
985
+                    new_workspace=destination_workspace
974 986
                 )
975 987
 
976 988
         transaction.commit()