Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions tests/test_not_support_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import unittest

from tests.test_client_it import ClientTestCase


class TailingSlashClientTestCase(ClientTestCase):
options = {
'webdav_hostname': 'http://localhost:8585/',
'webdav_login': 'alice',
'webdav_password': 'secret1234',
'webdav_override_methods': {
'check': 'PROPFIND'
}
}

def test_check_is_overridden(self):
self.assertEqual('PROPFIND', self.client.requests['check'])

if __name__ == '__main__':
unittest.main()
10 changes: 9 additions & 1 deletion webdav3/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,20 @@ def check(self, remote_path=root):

urn = Urn(remote_path)
try:
response = self.execute_request(action='check', path=urn.quote())
headers_ext = []
if self.requests.get('check') == 'PROPFIND':
headers_ext = ["Depth: 0"]
response = self.execute_request(action='check', path=urn.quote(), headers_ext=headers_ext)
except RemoteResourceNotFound:
return False

if int(response.status_code) == 200:
return True

if self.requests.get('check') == 'PROPFIND':
if int(response.status_code) == 207 and response.content:
return True

return False

@wrap_connection_error
Expand Down