Fixed #49: Remove tailing slashes in web_hostname

This commit is contained in:
Evgeny Ezhov 2020-04-05 17:43:10 -07:00
parent eeaf66a278
commit 39afefffc5
3 changed files with 27 additions and 2 deletions

View file

@ -50,6 +50,7 @@ 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:

View file

@ -34,13 +34,11 @@ 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]