Tweak regex to fix incorrect match (#237)
This commit is contained in:
@@ -44,7 +44,7 @@ class DownloadFactory:
|
|||||||
return Youtube
|
return Youtube
|
||||||
elif re.match(url_beginning + r'i\.redd\.it.*', url):
|
elif re.match(url_beginning + r'i\.redd\.it.*', url):
|
||||||
return Direct
|
return Direct
|
||||||
elif re.match(url_beginning + r'.*\..{3,4}$', url):
|
elif re.match(url_beginning + r'.*/.*\.\w{3,4}$', url):
|
||||||
return Direct
|
return Direct
|
||||||
else:
|
else:
|
||||||
raise NotADownloadableLinkError('No downloader module exists for url {}'.format(url))
|
raise NotADownloadableLinkError('No downloader module exists for url {}'.format(url))
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ def test_factory_lever_good(test_submission_id: str, expected_class: BaseDownloa
|
|||||||
@pytest.mark.parametrize('test_url', (
|
@pytest.mark.parametrize('test_url', (
|
||||||
'random.com',
|
'random.com',
|
||||||
'bad',
|
'bad',
|
||||||
|
'https://www.google.com/',
|
||||||
|
'https://www.google.com',
|
||||||
|
'https://www.google.com/test',
|
||||||
|
'https://www.google.com/test/',
|
||||||
))
|
))
|
||||||
def test_factory_lever_bad(test_url: str):
|
def test_factory_lever_bad(test_url: str):
|
||||||
with pytest.raises(NotADownloadableLinkError):
|
with pytest.raises(NotADownloadableLinkError):
|
||||||
|
|||||||
Reference in New Issue
Block a user