Skip to content

Commit

Permalink
allow for home-directory relative access in SFTP URLs. Specifically,
Browse files Browse the repository at this point in the history
sftp://host/path/to/file

points to path/to/file under the user's home directory.

sftp://host//path/to/file

points to an absolute path on the remote host.
  • Loading branch information
dangoor committed Sep 9, 2009
1 parent 53c7e8b commit 568807f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion omnisync/transports/sftp.py
Expand Up @@ -39,7 +39,11 @@ def __init__(self):
def _get_filename(self, url):
"""Retrieve the local filename from a given URL."""
split_url = urlfunctions.url_split(url, uses_hostname=self.uses_hostname)
return split_url.path
# paths are relative unless they start with two //
path = split_url.path
if len(path) > 1 and path.startswith("/"):
path = path[1:]
return path

# Transports should also implement the following methods:
def add_options(self):
Expand Down

0 comments on commit 568807f

Please sign in to comment.