changeset 7764:dbf3c33a516c

clone_url: simplify stripping of 'username@' from URLs when username is empty
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 16 Jul 2019 12:25:10 +0200
parents ca8f597c8fa8
children d83f41634d06
files kallithea/lib/utils2.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/utils2.py	Wed Jul 31 02:29:36 2019 +0200
+++ b/kallithea/lib/utils2.py	Tue Jul 16 12:25:10 2019 +0200
@@ -426,9 +426,10 @@
 
     # remove leading @ sign if it's present. Case of empty user
     url_obj = urlobject.URLObject(url)
-    url = url_obj.with_netloc(url_obj.netloc.lstrip('@'))
+    if not url_obj.username:
+        url_obj = url_obj.with_username(None)
 
-    return safe_unicode(url)
+    return safe_unicode(url_obj)
 
 
 def get_changeset_safe(repo, rev):