diff --git a/.travis.yml b/.travis.yml index 0873913..1bbd775 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,8 @@ dist: xenial addons: sonarcloud: organization: "ezhov-evgeny" - token: f0f714f3bea6bd103e3eb82724ef3bb0d3b54d1d + token: + secure: f0f714f3bea6bd103e3eb82724ef3bb0d3b54d1d services: - docker diff --git a/tests/test_tailing_slash_client_it.py b/tests/test_tailing_slash_client_it.py deleted file mode 100644 index 6a8744c..0000000 --- a/tests/test_tailing_slash_client_it.py +++ /dev/null @@ -1,26 +0,0 @@ -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': 'GET' - } - } - - def test_list_inner(self): - self._prepare_for_downloading(True) - file_list = self.client.list(self.remote_inner_path_dir) - self.assertIsNotNone(file_list, 'List of files should not be None') - - def test_hostname_no_tailing_slash(self): - self.assertEqual('5', self.client.webdav.hostname[-1]) - - -if __name__ == '__main__': - unittest.main() diff --git a/webdav3/client.py b/webdav3/client.py index 9e495d1..ca29f80 100644 --- a/webdav3/client.py +++ b/webdav3/client.py @@ -214,10 +214,9 @@ class Client(object): response = self.session.request( method=self.requests[action], url=self.get_url(path), - auth=(self.webdav.login, self.webdav.password) if (not self.webdav.token and not self.session.auth) else None, + auth=(self.webdav.login, self.webdav.password) if not self.webdav.token else None, headers=self.get_headers(action, headers_ext), timeout=self.timeout, - cert=(self.webdav.cert_path, self.webdav.key_path) if (self.webdav.cert_path and self.webdav.key_path) else None, data=data, stream=True, verify=self.verify diff --git a/webdav3/connection.py b/webdav3/connection.py index 499ba23..302212b 100644 --- a/webdav3/connection.py +++ b/webdav3/connection.py @@ -50,7 +50,6 @@ class WebDAVSettings(ConnectionSettings): self.root = Urn(self.root).quote() if self.root else '' self.root = self.root.rstrip(Urn.separate) - self.hostname = self.hostname.rstrip(Urn.separate) def is_valid(self): if not self.hostname: diff --git a/webdav3/urn.py b/webdav3/urn.py index e78fa24..6279de2 100644 --- a/webdav3/urn.py +++ b/webdav3/urn.py @@ -34,11 +34,13 @@ class Urn(object): return self._path def filename(self): + path_split = self._path.split(Urn.separate) name = path_split[-2] + Urn.separate if path_split[-1] == '' else path_split[-1] return unquote(name) def parent(self): + path_split = self._path.split(Urn.separate) nesting_level = self.nesting_level() parent_path_split = path_split[:nesting_level]