url: some bytes/str cleanup where we interface with stdlib funcs
authorAugie Fackler <augie@google.com>
Fri, 13 Apr 2018 21:04:25 -0400
changeset 37735 126998dcfb08
parent 37734 a1110db1e455
child 37736 e10b695b9c41
url: some bytes/str cleanup where we interface with stdlib funcs Differential Revision: https://phab.mercurial-scm.org/D3344
mercurial/url.py
--- a/mercurial/url.py	Fri Apr 13 21:01:17 2018 -0400
+++ b/mercurial/url.py	Fri Apr 13 21:04:25 2018 -0400
@@ -486,7 +486,8 @@
 
         cookiefile = util.expandpath(cookiefile)
         try:
-            cookiejar = util.cookielib.MozillaCookieJar(cookiefile)
+            cookiejar = util.cookielib.MozillaCookieJar(
+                pycompat.fsdecode(cookiefile))
             cookiejar.load()
             self.cookiejar = cookiejar
         except util.cookielib.LoadError as e:
@@ -591,6 +592,6 @@
         url_, authinfo = u.authinfo()
     else:
         path = util.normpath(os.path.abspath(url_))
-        url_ = 'file://' + urlreq.pathname2url(path)
+        url_ = 'file://' + pycompat.bytesurl(urlreq.pathname2url(path))
         authinfo = None
     return opener(ui, authinfo).open(pycompat.strurl(url_), data)