Browse Source

merge with master

Guénaël Muller 6 years ago
parent
commit
f3bbde5e73
2 changed files with 46 additions and 0 deletions
  1. 30 0
      doc/webdav.md
  2. 16 0
      tracim/tracim/lib/webdav/sql_resources.py

+ 30 - 0
doc/webdav.md View File

38
 - Go to "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters\BasicAuthLevel".
38
 - Go to "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters\BasicAuthLevel".
39
 - set "BasicAuthLevel" to "2".
39
 - set "BasicAuthLevel" to "2".
40
 
40
 
41
+### Fix Windows Big file >50Mb file download.
42
+
43
+To avoid security problems, Windows doesn't allow to download >50Mb file
44
+by default from WebDAV share.
45
+
46
+To change file size limit of Windows :
47
+- Launch regedit.
48
+- Go to "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters".
49
+- set "FileSizeLimitInBytes" as DWORD decimal to the number of bytes needed,
50
+for example. 1Go is 1073741824, 500Mo is 524288000.
51
+
52
+see here for more info:
53
+https://support.microsoft.com/en-us/help/900900/folder-copy-error-message-when-downloading-a-file-that-is-larger-than
54
+
55
+### Fix Windows 30 Minutes timeout with big file.
56
+
57
+Windows add also a 30 minutes timeout for big file. If you want download who take
58
+more time, set the default timeout value.
59
+
60
+To set the default timeout value:
61
+- Launch regedit.
62
+- Go to "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MRxDAV\Parameters"
63
+- set "FsCtlRequestTimeoutInSec" DWORD decimal to more than 1800 second (30Min).
64
+for example : 3600 : 1H , 14400 : 4H , 86400 : A day (24H).
65
+
66
+see here more info:
67
+https://support.microsoft.com/fr-fr/help/2668751/you-cannot-download-more-than-50-mb-or-upload-large-files-when-the-upl
68
+
69
+
41
 ## OSX
70
 ## OSX
42
 
71
 
43
 Webdav OSX addresses are similar to:
72
 Webdav OSX addresses are similar to:
52
 - Your login/password will be ask. Use your Tracim credentials.
81
 - Your login/password will be ask. Use your Tracim credentials.
53
 - After that, your webdav access should be mounted.
82
 - After that, your webdav access should be mounted.
54
 
83
 
84
+
55
 ## Linux
85
 ## Linux
56
 
86
 
57
 Webdav Linux addresses are similar to:
87
 Webdav Linux addresses are similar to:

+ 16 - 0
tracim/tracim/lib/webdav/sql_resources.py View File

162
 
162
 
163
         self._file_count = 0
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
     def __repr__(self) -> str:
169
     def __repr__(self) -> str:
166
         return "<DAVCollection: Workspace (%d)>" % self.workspace.workspace_id
170
         return "<DAVCollection: Workspace (%d)>" % self.workspace.workspace_id
167
 
171
 
217
         if resource:
221
         if resource:
218
             content = resource.content
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
         if not content:
229
         if not content:
221
             # INFO - G.M - 21-03-2018 create new empty file and commit it.
230
             # INFO - G.M - 21-03-2018 create new empty file and commit it.
222
             new_empty_file = FakeFileStream(
231
             new_empty_file = FakeFileStream(
411
             invalid_path = invalid_path or any(x in self.path for x in ['.deleted', '.archived'])
420
             invalid_path = invalid_path or any(x in self.path for x in ['.deleted', '.archived'])
412
             invalid_path = invalid_path or dirname(destpath) == self.environ['http_authenticator.realm']
421
             invalid_path = invalid_path or dirname(destpath) == self.environ['http_authenticator.realm']
413
 
422
 
423
+
414
             if not invalid_path:
424
             if not invalid_path:
415
                 self.move_folder(destpath)
425
                 self.move_folder(destpath)
416
 
426
 
845
         self.content = content
855
         self.content = content
846
         self.user = UserApi(None).get_one_by_email(environ['http_authenticator.username'])
856
         self.user = UserApi(None).get_one_by_email(environ['http_authenticator.username'])
847
         self.content_api = ContentApi(self.user)
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
         # this is the property that windows client except to check if the file is read-write or read-only,
862
         # this is the property that windows client except to check if the file is read-write or read-only,
850
         # but i wasn't able to set this property so you'll have to look into it >.>
863
         # but i wasn't able to set this property so you'll have to look into it >.>
927
             invalid_path = any(x in destpath for x in ['.deleted', '.archived'])
940
             invalid_path = any(x in destpath for x in ['.deleted', '.archived'])
928
             invalid_path = invalid_path or any(x in self.path for x in ['.deleted', '.archived'])
941
             invalid_path = invalid_path or any(x in self.path for x in ['.deleted', '.archived'])
929
             invalid_path = invalid_path or dirname(destpath) == self.environ['http_authenticator.realm']
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
             if not invalid_path:
947
             if not invalid_path:
932
                 self.move_file(destpath)
948
                 self.move_file(destpath)