Don't permit embedded #'s in URLs.

This is a fix for a minor issue caught in review of 198186

Change-Id: Ic27acf79b4a189f9348edcd37523403202e6fc0b
This commit is contained in:
Robert Collins 2015-07-06 14:59:46 +12:00
parent a6aa3da227
commit 6b06c5d0fd
2 changed files with 6 additions and 1 deletions
openstack_requirements

@ -37,7 +37,7 @@ Requirements = collections.namedtuple('Requirements', ['reqs'])
url_re = re.compile(
'^(?P<url>\s*(?:-e\s)?\s*(?:(?:git+)?https|http|file)://.*)'
'^(?P<url>\s*(?:-e\s)?\s*(?:(?:git+)?https|http|file)://[^#]*)'
'#egg=(?P<name>[-\w]+)')

@ -59,6 +59,11 @@ class TestParseRequirement(testtools.TestCase):
req=requirement.Requirement('thing', 'file:///path/to/thing', '', '',
''),
permit_urls=True)),
('url-comment', dict(
line='file:///path/to/thing#egg=thing # http://altpath#egg=boo',
req=requirement.Requirement('thing', 'file:///path/to/thing', '', '',
'# http://altpath#egg=boo'),
permit_urls=True)),
('editable', dict(
line='-e file:///path/to/bar#egg=bar',
req=requirement.Requirement('bar', '-e file:///path/to/bar', '', '',