Browse Source

Merge branch 'master' of github.com:tracim/tracim

Come 8 years ago
parent
commit
cd63f08ae6
1 changed files with 8 additions and 11 deletions
  1. 8 11
      tracim/tracim/lib/webdav/sql_resources.py

+ 8 - 11
tracim/tracim/lib/webdav/sql_resources.py View File

@@ -948,23 +948,20 @@ class File(DAVNonCollection):
948 948
 
949 949
     def move_file(self, destpath):
950 950
 
951
-        workspace = self.provider.get_workspace_from_path(
952
-            normpath(destpath),
953
-            WorkspaceApi(self.user)
954
-        )
955
-
956
-        parent = self.provider.get_parent_from_path(
957
-            normpath(destpath),
958
-            self.content_api,
959
-            workspace
960
-        )
951
+        workspace = self.content.workspace
952
+        parent = self.content.parent
961 953
 
962 954
         with new_revision(self.content):
963 955
             if basename(destpath) != self.getDisplayName():
956
+                new_given_file_name = transform_to_bdd(basename(destpath))
957
+                new_file_name, new_file_extension = \
958
+                    os.path.splitext(new_given_file_name)
959
+
964 960
                 self.content_api.update_content(
965 961
                     self.content,
966
-                    transform_to_bdd(basename(destpath)),
962
+                    new_file_name,
967 963
                 )
964
+                self.content.file_extension = new_file_extension
968 965
                 self.content_api.save(self.content)
969 966
             else:
970 967
                 self.content_api.move(