Browse Source

Quote special characters in usernames.

Jelmer Vernooij 8 years ago
parent
commit
3b134a69e6
1 changed files with 6 additions and 1 deletions
  1. 6 1
      dulwich/client.py

+ 6 - 1
dulwich/client.py

@@ -46,6 +46,11 @@ import socket
 import subprocess
 import sys
 
+try:
+    from urllib import quote as urlquote
+except ImportError:
+    from urllib.parse import quote as urlquote
+
 try:
     import urllib2
     import urlparse
@@ -948,7 +953,7 @@ class SSHGitClient(TraditionalGitClient):
             netloc += ":%d" % self.port
 
         if self.username is not None:
-            netloc = self.username + "@" + netloc
+            netloc = urlquote(self.username, '@/:') + "@" + netloc
 
         return urlparse.urlunsplit(('ssh', netloc, path, '', ''))