improve link header parameter extraction regex

pull/164/head
codl 2019-04-15 14:26:43 +02:00
rodzic 62a47f4e92
commit eca31ea732
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6CD7C8891ED1233A
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -2272,7 +2272,7 @@ class Mastodon:
if url['rel'] == 'next': if url['rel'] == 'next':
# Be paranoid and extract max_id specifically # Be paranoid and extract max_id specifically
next_url = url['url'] next_url = url['url']
matchgroups = re.search(r"max_id=([^&]+)", next_url) matchgroups = re.search(r"[?&]max_id=([^&]+)", next_url)
if matchgroups: if matchgroups:
next_params = copy.deepcopy(params) next_params = copy.deepcopy(params)
@ -2290,7 +2290,7 @@ class Mastodon:
if url['rel'] == 'prev': if url['rel'] == 'prev':
# Be paranoid and extract since_id specifically # Be paranoid and extract since_id specifically
prev_url = url['url'] prev_url = url['url']
matchgroups = re.search(r"since_id=([^&]+)", prev_url) matchgroups = re.search(r"[?&]since_id=([^&]+)", prev_url)
if matchgroups: if matchgroups:
prev_params = copy.deepcopy(params) prev_params = copy.deepcopy(params)