1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

ensure that the RemoteCDXIndexSource also adds a 'matchType=' param,

possible fix for ukwa-pywb/ukwa#57
This commit is contained in:
Ilya Kreymer 2020-06-19 12:17:06 -07:00
parent 2e35c3e1ed
commit c7e626d2b0
3 changed files with 16 additions and 2 deletions

View File

@ -1,4 +1,4 @@
__version__ = '2.4.1' __version__ = '2.4.2-beta'
if __name__ == '__main__': if __name__ == '__main__':
print(__version__) print(__version__)

View File

@ -125,6 +125,9 @@ class RemoteIndexSource(BaseIndexSource):
if 'closest' in params and self.closest_limit: if 'closest' in params and self.closest_limit:
api_url += '&limit=' + str(self.closest_limit) api_url += '&limit=' + str(self.closest_limit)
if 'matchType' in params:
api_url += '&matchType=' + params.get('matchType')
return api_url return api_url
def load_index(self, params): def load_index(self, params):

View File

@ -110,6 +110,17 @@ com,instagram)/amaliaulman 20141014171954 https://webenact.rhizome.org/all/20141
assert(key_ts_res(res, 'load_url') == expected) assert(key_ts_res(res, 'load_url') == expected)
assert(errs == {}) assert(errs == {})
# Url Match -- Remote Loaders
def test_remote_loader_with_prefix(self):
url = 'http://instagram.com/amaliaulman?__=1234234234'
remote_source = self.all_sources['remote_cdx']
res, errs = self.query_single_source(remote_source, dict(url=url, closest='20141014162332', limit=1, allowFuzzy='0'))
expected = """\
com,instagram)/amaliaulman 20141014162333 https://webenact.rhizome.org/all/20141014162333id_/http://instagram.com/amaliaulman"""
assert(key_ts_res(res, 'load_url') == expected)
assert(errs == {})
# Url Match -- Remote Loaders Closest # Url Match -- Remote Loaders Closest
def test_remote_closest_loader(self, remote_source): def test_remote_closest_loader(self, remote_source):
@ -123,7 +134,7 @@ com,instagram)/amaliaulman 20141014162333 https://webenact.rhizome.org/all/20141
assert(errs == {}) assert(errs == {})
# Url Match -- Wb Memento # Url Match -- Wb Memento
def test_remote_closest_wb_memnto_loader(self): def test_remote_closest_wb_memento_loader(self):
replay = 'https://webenact.rhizome.org/all/{timestamp}id_/{url}' replay = 'https://webenact.rhizome.org/all/{timestamp}id_/{url}'
source = WBMementoIndexSource(replay, '', replay) source = WBMementoIndexSource(replay, '', replay)