Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
c7c20d8c
Commit
c7c20d8c
authored
Oct 05, 2019
by
Brian Turek
Committed by
Sébastien Eustace
Oct 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for special characters in username/password for pip (#1341)
parent
a581ff62
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
poetry/repositories/legacy_repository.py
+7
-2
tests/repositories/test_legacy_repository.py
+10
-2
No files found.
poetry/repositories/legacy_repository.py
View file @
c7c20d8c
...
...
@@ -21,6 +21,11 @@ from typing import Generator
from
typing
import
Optional
from
typing
import
Union
try
:
from
urllib.parse
import
quote
except
ImportError
:
from
urllib
import
quote
import
requests
from
cachecontrol
import
CacheControl
...
...
@@ -197,8 +202,8 @@ class LegacyRepository(PyPiRepository):
return
"{scheme}://{username}:{password}@{netloc}{path}"
.
format
(
scheme
=
parsed
.
scheme
,
username
=
self
.
_auth
.
auth
.
username
,
password
=
self
.
_auth
.
auth
.
password
,
username
=
quote
(
self
.
_auth
.
auth
.
username
)
,
password
=
quote
(
self
.
_auth
.
auth
.
password
)
,
netloc
=
parsed
.
netloc
,
path
=
parsed
.
path
,
)
...
...
tests/repositories/test_legacy_repository.py
View file @
c7c20d8c
...
...
@@ -7,6 +7,7 @@ except ImportError:
import
urlparse
from
poetry.packages
import
Dependency
from
poetry.repositories.auth
import
Auth
from
poetry.repositories.exceptions
import
PackageNotFound
from
poetry.repositories.legacy_repository
import
LegacyRepository
from
poetry.repositories.legacy_repository
import
Page
...
...
@@ -18,9 +19,9 @@ class MockRepository(LegacyRepository):
FIXTURES
=
Path
(
__file__
)
.
parent
/
"fixtures"
/
"legacy"
def
__init__
(
self
):
def
__init__
(
self
,
auth
=
None
):
super
(
MockRepository
,
self
)
.
__init__
(
"legacy"
,
url
=
"http://foo.bar"
,
disable_cache
=
True
"legacy"
,
url
=
"http://foo.bar"
,
auth
=
auth
,
disable_cache
=
True
)
def
_get
(
self
,
endpoint
):
...
...
@@ -255,3 +256,10 @@ def test_get_package_retrieves_packages_with_no_hashes():
package
=
repo
.
package
(
"jupyter"
,
"1.0.0"
)
assert
[]
==
package
.
hashes
def
test_username_password_special_chars
():
auth
=
Auth
(
"http://foo.bar"
,
"user:"
,
"p@ssword"
)
repo
=
MockRepository
(
auth
=
auth
)
assert
"http://user
%3
A:p
%40
ssword@foo.bar"
==
repo
.
authenticated_url
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment