Guénaël Muller пре 6 година
родитељ
комит
f3bbde5e73
2 измењених фајлова са 46 додато и 0 уклоњено
  1. 30 0
      doc/webdav.md
  2. 16 0
      tracim/tracim/lib/webdav/sql_resources.py

+ 30 - 0
doc/webdav.md Прегледај датотеку

@@ -38,6 +38,35 @@ To enable it:
38 38
 - Go to "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters\BasicAuthLevel".
39 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 70
 ## OSX
42 71
 
43 72
 Webdav OSX addresses are similar to:
@@ -52,6 +81,7 @@ http://<yourinstance>/webdav/ (unsecure)
52 81
 - Your login/password will be ask. Use your Tracim credentials.
53 82
 - After that, your webdav access should be mounted.
54 83
 
84
+
55 85
 ## Linux
56 86
 
57 87
 Webdav Linux addresses are similar to:

+ 16 - 0
tracim/tracim/lib/webdav/sql_resources.py Прегледај датотеку

@@ -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)