Skip to content

Commit 3e2bf91

Browse files
authored
Merge pull request #32 from retr0h/bug-29
Corrected processing of URLs with hyphen
2 parents 3c3ba25 + ea32b30 commit 3e2bf91

File tree

3 files changed

+209
-105
lines changed

3 files changed

+209
-105
lines changed

giturlparse/parser.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,24 @@
4141
r'(?P<resource>[a-z0-9_.-]*)'
4242
r'[:/]*'
4343
r'(?P<port>[\d]+){0,1}'
44-
r'(?P<pathname>\/(?P<owner>.+)/(?P<name>.+).git)'),
44+
r'(?P<pathname>\/((?P<owner>[\w\-]+)\/)?'
45+
r'((?P<name>[\w\-]+)(\.git)?)?)$'),
4546
re.compile(r'(git\+)?'
4647
r'((?P<protocol>\w+)://)'
4748
r'((?P<user>\w+)@)?'
4849
r'((?P<resource>[\w\.\-]+))'
4950
r'(:(?P<port>\d+))?'
5051
r'(?P<pathname>(\/(?P<owner>\w+)/)?'
51-
r'(\/?(?P<name>[\w\-]+)(\.git)?)?)'),
52+
r'(\/?(?P<name>[\w\-]+)(\.git)?)?)$'),
5253
re.compile(r'^(?:(?P<user>.+)@)*'
5354
r'(?P<resource>[a-z0-9_.-]*)[:/]*'
5455
r'(?P<port>[\d]+){0,1}'
55-
r'[:](?P<pathname>\/?(?P<owner>.+)/(?P<name>.+).git)'),
56+
r'[:](?P<pathname>\/?(?P<owner>.+)/(?P<name>.+).git)$'),
5657
re.compile(r'((?P<user>\w+)@)?'
5758
r'((?P<resource>[\w\.\-]+))'
5859
r'[\:\/]{1,2}'
5960
r'(?P<pathname>((?P<owner>\w+)/)?'
60-
r'((?P<name>[\w\-]+)(\.git)?)?)'),
61+
r'((?P<name>[\w\-]+)(\.git)?)?)$'),
6162
)
6263

6364

0 commit comments

Comments
 (0)