Error regex when get total page count
bytemain opened this issue · comments
野声 commented
https://github.com/bytebase/star-history/blob/master/src/helpers/api.ts#L93
headers' link example:
const link = `<https://api.github.com/repositories/xxx/stargazers?per_page=30&page=2>; rel="next", <https://api.github.com/repositories/xxx/stargazers?per_page=30&page=7>; rel="last"`;
const regResult = /next.*?page=(\d*).*?last/.exec(link);
console.log(regResult);
the regResult
will always 30...
so it's better change the regex:
- /next.*?page=(\d*).*?last/
+ /next.*page=(\d*).*?last/