Skip to content

Commit

Permalink
Fix for GitHub Enterprise.
Browse files Browse the repository at this point in the history
Remove hardcoded hostname api.github.com from pagination links. This
fixes pagination for self-hosted GitHub Enterprise.
  • Loading branch information
Fritz committed Jan 9, 2016
1 parent 49f4e1a commit 72a8989
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion octohub/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ def __iter__(self):
if not 'next' in response.parsed_link.keys():
break

self.uri = response.parsed_link.next.uri
# Parsed link is absolute. Connection wants a relative link,
# so remove protocol and GitHub endpoint for the pagination URI.
m = re.match(self.conn.endpoint + '(.*)', response.parsed_link.next.uri)
self.uri = m.groups()[0]
self.params = response.parsed_link.next.params

class Connection(object):
Expand Down
2 changes: 1 addition & 1 deletion octohub/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def _parse_link(header_link):
for s in header_link.split(','):
link = AttrDict()

m = re.match('<https://api.github.com(.*)\?(.*)>', s.split(';')[0].strip())
m = re.match('<(.*)\?(.*)>', s.split(';')[0].strip())
link.uri = m.groups()[0]
link.params = {}
for kv in m.groups()[1].split('&'):
Expand Down

0 comments on commit 72a8989

Please sign in to comment.