From b3e477720667bbf5a39c21dc14b62852fd96465b Mon Sep 17 00:00:00 2001 From: OMEGA_RAZER <869111+OMEGARAZER@users.noreply.github.com> Date: Mon, 19 Dec 2022 22:02:16 -0500 Subject: [PATCH 1/2] Update download_factory.py Attempt to fix #724 Narrows down characters available to extensions in the regex. Outside of 3 and 4, the only extensions that I can think of this doesn't hit are bz2 and 7z (which wasn't caught before). --- bdfr/site_downloaders/download_factory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bdfr/site_downloaders/download_factory.py b/bdfr/site_downloaders/download_factory.py index 638316f..1bc7507 100644 --- a/bdfr/site_downloaders/download_factory.py +++ b/bdfr/site_downloaders/download_factory.py @@ -30,7 +30,7 @@ class DownloadFactory: return Imgur elif re.match(r"(i\.)?(redgifs|gifdeliverynetwork)", sanitised_url): return Redgifs - elif re.match(r".*/.*\.\w{3,4}(\?[\w;&=]*)?$", sanitised_url) and not DownloadFactory.is_web_resource( + elif re.match(r".*/.*\.[a-zA-Z34]{3,4}(\?[\w;&=]*)?$", sanitised_url) and not DownloadFactory.is_web_resource( sanitised_url ): return Direct From da74096cdec9561593c04f1a39656c916ec10943 Mon Sep 17 00:00:00 2001 From: OMEGA_RAZER <869111+OMEGARAZER@users.noreply.github.com> Date: Mon, 19 Dec 2022 22:04:49 -0500 Subject: [PATCH 2/2] Update test_download_factory.py --- tests/site_downloaders/test_download_factory.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/site_downloaders/test_download_factory.py b/tests/site_downloaders/test_download_factory.py index 581656d..b369486 100644 --- a/tests/site_downloaders/test_download_factory.py +++ b/tests/site_downloaders/test_download_factory.py @@ -65,6 +65,7 @@ def test_factory_lever_good(test_submission_url: str, expected_class: BaseDownlo "https://www.google.com", "https://www.google.com/test", "https://www.google.com/test/", + "https://www.tiktok.com/@keriberry.420", ), ) def test_factory_lever_bad(test_url: str):