From 7b45df7338cb37a819550460697cdfa5494d6617 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Mon, 10 Oct 2016 17:00:36 -0700 Subject: [PATCH] wburl: support for new modifier form: $mod as well as 'mod_' --- pywb/rewrite/test/test_wburl.py | 3 +++ pywb/rewrite/wburl.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pywb/rewrite/test/test_wburl.py b/pywb/rewrite/test/test_wburl.py index 580d1a02..05cf70ef 100644 --- a/pywb/rewrite/test/test_wburl.py +++ b/pywb/rewrite/test/test_wburl.py @@ -13,6 +13,9 @@ u""" >>> repr(WbUrl('20130102im_/https:/example.com')) "('replay', '20130102', 'im_', 'https://example.com', '20130102im_/https://example.com')" +>>> repr(WbUrl('20130102$cbr:test-foo.123/https:/example.com')) +"('replay', '20130102', '$cbr:test-foo.123', 'https://example.com', '20130102$cbr:test-foo.123/https://example.com')" + # Protocol agnostic convert to http >>> repr(WbUrl('20130102im_///example.com')) "('replay', '20130102', 'im_', 'http://example.com', '20130102im_/http://example.com')" diff --git a/pywb/rewrite/wburl.py b/pywb/rewrite/wburl.py index df414d22..1853ed01 100644 --- a/pywb/rewrite/wburl.py +++ b/pywb/rewrite/wburl.py @@ -91,7 +91,7 @@ class WbUrl(BaseWbUrl): # Regexs # ====================== QUERY_REGEX = re.compile('^(?:([\w\-:]+)/)?(\d*)[*-](\d*)/?(.+)$') - REPLAY_REGEX = re.compile('^(\d*)([a-z]+_)?/{1,3}(.+)$') + REPLAY_REGEX = re.compile('^(\d*)([a-z]+_|[$][a-z0-9:.-]+)?/{1,3}(.+)$') #LATEST_REPLAY_REGEX = re.compile('^\w_)') DEFAULT_SCHEME = 'http://'