Patchwork D3344: url: some bytes/str cleanup where we interface with stdlib funcs

login
register
mail settings
Submitter phabricator
Date April 14, 2018, 4:32 a.m.
Message ID <differential-rev-PHID-DREV-c6ua6ijjnen6t7rmjplv-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30968/
State Superseded
Headers show

Comments

phabricator - April 14, 2018, 4:32 a.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3344

AFFECTED FILES
  mercurial/url.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/url.py b/mercurial/url.py
--- a/mercurial/url.py
+++ b/mercurial/url.py
@@ -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)