1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-24 06:59:52 +01:00

cdx: ensure url param required check is performed on init

This commit is contained in:
Ilya Kreymer 2016-02-22 13:59:07 -08:00
parent af7c876263
commit 57991fd0cf

View File

@ -7,8 +7,8 @@ from pywb.utils.canonicalize import calc_search_range
class CDXQuery(object): class CDXQuery(object):
def __init__(self, **kwargs): def __init__(self, **kwargs):
self.params = kwargs self.params = kwargs
url = self.url
if not self.params.get('matchType'): if not self.params.get('matchType'):
url = self.params.get('url', '')
if url.startswith('*.'): if url.startswith('*.'):
self.params['url'] = url[2:] self.params['url'] = url[2:]
self.params['matchType'] = 'domain' self.params['matchType'] = 'domain'
@ -18,7 +18,7 @@ class CDXQuery(object):
else: else:
self.params['matchType'] = 'exact' self.params['matchType'] = 'exact'
start, end = calc_search_range(url=self.params['url'], start, end = calc_search_range(url=url,
match_type=self.params['matchType'], match_type=self.params['matchType'],
url_canon=self.params.get('_url_canon')) url_canon=self.params.get('_url_canon'))