|
@@ -162,6 +162,10 @@ class Workspace(DAVCollection):
|
162
|
162
|
|
163
|
163
|
self._file_count = 0
|
164
|
164
|
|
|
165
|
+ # FIXME : Remove this regex when tracim become
|
|
166
|
+ # able to deal with file at root of workspace
|
|
167
|
+ self._subfolder_regex = re.compile('^{}[^/]*$'.format(environ['http_authenticator.realm'])) # nopep8
|
|
168
|
+
|
165
|
169
|
def __repr__(self) -> str:
|
166
|
170
|
return "<DAVCollection: Workspace (%d)>" % self.workspace.workspace_id
|
167
|
171
|
|
|
@@ -217,6 +221,11 @@ class Workspace(DAVCollection):
|
217
|
221
|
if resource:
|
218
|
222
|
content = resource.content
|
219
|
223
|
|
|
224
|
+ # FIXME : Remove this regex when tracim become
|
|
225
|
+ # able to deal with file at root of workspace
|
|
226
|
+ if self._subfolder_regex.match(dirname(path)):
|
|
227
|
+ raise DAVError(HTTP_FORBIDDEN)
|
|
228
|
+
|
220
|
229
|
if not content:
|
221
|
230
|
# INFO - G.M - 21-03-2018 create new empty file and commit it.
|
222
|
231
|
new_empty_file = FakeFileStream(
|
|
@@ -411,6 +420,7 @@ class Folder(Workspace):
|
411
|
420
|
invalid_path = invalid_path or any(x in self.path for x in ['.deleted', '.archived'])
|
412
|
421
|
invalid_path = invalid_path or dirname(destpath) == self.environ['http_authenticator.realm']
|
413
|
422
|
|
|
423
|
+
|
414
|
424
|
if not invalid_path:
|
415
|
425
|
self.move_folder(destpath)
|
416
|
426
|
|
|
@@ -845,6 +855,9 @@ class File(DAVNonCollection):
|
845
|
855
|
self.content = content
|
846
|
856
|
self.user = UserApi(None).get_one_by_email(environ['http_authenticator.username'])
|
847
|
857
|
self.content_api = ContentApi(self.user)
|
|
858
|
+ # FIXME : Remove this regex when tracim become
|
|
859
|
+ # able to deal with file at root of workspace
|
|
860
|
+ self._subfolder_regex = re.compile('^{}[^/]*$'.format(environ['http_authenticator.realm'])) # nopep8
|
848
|
861
|
|
849
|
862
|
# this is the property that windows client except to check if the file is read-write or read-only,
|
850
|
863
|
# but i wasn't able to set this property so you'll have to look into it >.>
|
|
@@ -927,6 +940,9 @@ class File(DAVNonCollection):
|
927
|
940
|
invalid_path = any(x in destpath for x in ['.deleted', '.archived'])
|
928
|
941
|
invalid_path = invalid_path or any(x in self.path for x in ['.deleted', '.archived'])
|
929
|
942
|
invalid_path = invalid_path or dirname(destpath) == self.environ['http_authenticator.realm']
|
|
943
|
+ # FIXME : Remove this regex when tracim become
|
|
944
|
+ # able to deal with file at root of workspace
|
|
945
|
+ invalid_path = invalid_path or self._subfolder_regex.match(dirname(destpath))
|
930
|
946
|
|
931
|
947
|
if not invalid_path:
|
932
|
948
|
self.move_file(destpath)
|