def http_normalize(path): if '/' in path or len(path) != 64: s = posixpath.join(self.base, path) else: s = posixpath.join(self.base, normalize_srl_path(path)) return "{scheme}://{host}:{port}{path}".format(scheme=scheme, host=host, port=port, path=s)
def sftp_normalize(path): # If they've provided an absolute path. Leave it a is. if path.startswith('/'): s = path # Relative paths elif '/' in path or len(path) != 64: s = posixpath.join(self.base, path) else: s = posixpath.join(self.base, normalize_srl_path(path)) self.log.debug('sftp normalized: %s -> %s', path, s) return s