Fixed _url_join when None in parameters
Change-Id: I342f91085ae689c29175bc8d5d4bd357b2408d02
diff --git a/rsync_url.py b/rsync_url.py
index 968a627..83061ff 100644
--- a/rsync_url.py
+++ b/rsync_url.py
@@ -158,7 +158,7 @@
while url.endswith(os.path.sep):
url = url[:-1]
- subs = os.path.sep.join(suburls).split(os.path.sep)
+ subs = os.path.sep.join([_ for _ in suburls if _]).split(os.path.sep)
subs = [_ for _ in subs if _]
result = re.sub(r'^//', r'/', os.path.sep.join([url, ] + subs))
diff --git a/test_rsync_url.yaml b/test_rsync_url.yaml
index 8e205c2..1dc42c0 100644
--- a/test_rsync_url.yaml
+++ b/test_rsync_url.yaml
@@ -8,11 +8,13 @@
'ubuntu@172.18.66.89:~':
url: 'ubuntu@172.18.66.89:~'
url_in:
+ null: 'ubuntu@172.18.66.89:~/'
'': 'ubuntu@172.18.66.89:~/'
'/': 'ubuntu@172.18.66.89:~/'
'/first/level/': 'ubuntu@172.18.66.89:~/first/level/'
'first/level': 'ubuntu@172.18.66.89:~/first/level/'
url_is:
+ null: 'ubuntu@172.18.66.89:~'
'': 'ubuntu@172.18.66.89:~'
'/': 'ubuntu@172.18.66.89:~'
'/first/level/': 'ubuntu@172.18.66.89:~/first/level'
@@ -63,11 +65,13 @@
'johnivanov@172.18.66.89::mirror-sync/otlichniy/reg/exp':
url: 'johnivanov@172.18.66.89::mirror-sync/otlichniy/reg/exp'
url_in:
+ null: 'johnivanov@172.18.66.89::mirror-sync/otlichniy/reg/exp/'
'': 'johnivanov@172.18.66.89::mirror-sync/otlichniy/reg/exp/'
'/': 'johnivanov@172.18.66.89::mirror-sync/otlichniy/reg/exp/'
'/first/level/': 'johnivanov@172.18.66.89::mirror-sync/otlichniy/reg/exp/first/level/'
'first/level': 'johnivanov@172.18.66.89::mirror-sync/otlichniy/reg/exp/first/level/'
url_is:
+ null: 'johnivanov@172.18.66.89::mirror-sync/otlichniy/reg/exp'
'': 'johnivanov@172.18.66.89::mirror-sync/otlichniy/reg/exp'
'/': 'johnivanov@172.18.66.89::mirror-sync/otlichniy/reg/exp'
'/first/level/': 'johnivanov@172.18.66.89::mirror-sync/otlichniy/reg/exp/first/level'
@@ -125,11 +129,13 @@
'rsync://mirror-sync@172.18.66.89:7327/otlichniy/reg/exp':
url: 'rsync://mirror-sync@172.18.66.89:7327/otlichniy/reg/exp'
url_in:
+ null: 'rsync://mirror-sync@172.18.66.89:7327/otlichniy/reg/exp/'
'': 'rsync://mirror-sync@172.18.66.89:7327/otlichniy/reg/exp/'
'/': 'rsync://mirror-sync@172.18.66.89:7327/otlichniy/reg/exp/'
'/first/level/': 'rsync://mirror-sync@172.18.66.89:7327/otlichniy/reg/exp/first/level/'
'first/level': 'rsync://mirror-sync@172.18.66.89:7327/otlichniy/reg/exp/first/level/'
url_is:
+ null: 'rsync://mirror-sync@172.18.66.89:7327/otlichniy/reg/exp'
'': 'rsync://mirror-sync@172.18.66.89:7327/otlichniy/reg/exp'
'/': 'rsync://mirror-sync@172.18.66.89:7327/otlichniy/reg/exp'
'/first/level/': 'rsync://mirror-sync@172.18.66.89:7327/otlichniy/reg/exp/first/level'
@@ -190,11 +196,13 @@
'/':
url: '/'
url_in:
+ null: '/'
'': '/'
'/': '/'
'/first/level/': '/first/level/'
'first/level': '/first/level/'
url_is:
+ null: '/'
'': '/'
'/': '/'
'/first/level/': '/first/level'