cfpb / github-wiki-search

:warning: DEPRECATED :warning:
Creative Commons Zero v1.0 Universal
7 stars 17 forks source link

Fix invalid link extracted from response headers #111

Closed OrlandoSoto closed 6 years ago

OrlandoSoto commented 6 years ago

While working on (https://jira.demo.cfpb.gov/browse/DEV-2474) I noticed that index.py was broken, this fixes the indexing URL problem.

OrlandoSoto commented 6 years ago

The response header links look like this

<https://api.github.com/organizations/1071563/repos?page=2>; rel="next", <https://api.github.com/organizations/1071563/repos?page=9>; rel="last"

the regex in the script then returns an invalid next page URL like this

https://api.github.com/organizations/1071563/repos?page=2>; rel="next", <https://api.github.com/organizations/1071563/repos?page=9

this commit splits the header response links into a list (before the regex) with items like this one:

<https://api.github.com/organizations/1071563/repos?page=2>; rel="next"

so the regex is able to generate a properly formed next page URL like this one

https://api.github.com/organizations/1071563/repos?page=2"