Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setuptools fails to parse a package url with query parameters properly #1366

jendabenda opened this issue May 16, 2018 · 2 comments


Copy link

@jendabenda jendabenda commented May 16, 2018

Setuptools fails to parse a package url with query parameters properly


private pip server, package_name, list of package versions on url as html page at

on the page there is a link in html which points to a package file to download
<a href=";tokenb=B">package_name-0.1.2.tar.gz</a>


href attribute
gets parased as
instead of

note &amp; => amp instead of &


href decoding in function htmldecode
regexp called entity_sub is wrong

# This pattern matches a character entity reference (a decimal numeric

instead of

entity_sub = re.compile(r'&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?').sub

should be

entity_sub = re.compile(r'(&#(\d+|x[\da-fA-F]+)|[\w.:-]+;?)').sub

note rounded brackets inside regular expression

jaraco added a commit that referenced this issue Jun 5, 2018
Copy link

@jaraco jaraco commented Jun 5, 2018

Thanks for the report. In addition to your patch, I created a test to validate the patch, but was unsuccessful. See the linked branch.

Copy link

@jendabenda jendabenda commented Jun 5, 2018

ok, my bad it worked only in certain cases

this simple patch will do the job (no need to modify entity_sub)

@@ -933,7 +933,7 @@ entity_sub = re.compile(r'&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?').sub
 def decode_entity(match):
-    what =
+    what =
     return unescape(what)
@jaraco jaraco closed this in 95880b3 Jun 6, 2018
jaraco added a commit that referenced this issue Jun 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants