From eca31ea732d1c2c8f0491a138b2940e828a45973 Mon Sep 17 00:00:00 2001 From: codl Date: Mon, 15 Apr 2019 14:26:43 +0200 Subject: [PATCH] improve link header parameter extraction regex --- mastodon/Mastodon.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 123d1a6..3f594cf 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -2272,7 +2272,7 @@ class Mastodon: if url['rel'] == 'next': # Be paranoid and extract max_id specifically next_url = url['url'] - matchgroups = re.search(r"max_id=([^&]+)", next_url) + matchgroups = re.search(r"[?&]max_id=([^&]+)", next_url) if matchgroups: next_params = copy.deepcopy(params) @@ -2290,7 +2290,7 @@ class Mastodon: if url['rel'] == 'prev': # Be paranoid and extract since_id specifically prev_url = url['url'] - matchgroups = re.search(r"since_id=([^&]+)", prev_url) + matchgroups = re.search(r"[?&]since_id=([^&]+)", prev_url) if matchgroups: prev_params = copy.deepcopy(params)