Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

reverted previous changed as it broke tests

Pablo Hoffmand9043ffa6ea8
diff --git a/scrapy/tests/test_utils_url.py b/scrapy/tests/test_utils_url.py
index 68cf424ed..51ba14dd0 100644
--- a/scrapy/tests/test_utils_url.py
+++ b/scrapy/tests/test_utils_url.py
@@ -158,13 +158,6 @@ class UrlUtilsTest(unittest.TestCase):
self.assertEqual(canonicalize_url("http://foo.com/AC%2FDC/"),
"http://foo.com/AC%2FDC/")
- def test_url_has_any_extension(self):
- self.assertTrue(url_has_any_extension("http://www.example.com/page.doc", IGNORED_EXTENSIONS))
- self.assertTrue(url_has_any_extension("http://www.example.com/page.pdf", IGNORED_EXTENSIONS))
- self.assertFalse(url_has_any_extension("http://www.example.com/page.htm", IGNORED_EXTENSIONS))
- self.assertFalse(url_has_any_extension("http://www.example.com/", IGNORED_EXTENSIONS))
- self.assertFalse(url_has_any_extension("http://www.example.com/page.doc.html", IGNORED_EXTENSIONS))
-
if __name__ == "__main__":
unittest.main()
diff --git a/scrapy/utils/url.py b/scrapy/utils/url.py
index 16868b027..bc8236e1a 100644
--- a/scrapy/utils/url.py
+++ b/scrapy/utils/url.py
@@ -28,7 +28,7 @@ def url_is_from_spider(url, spider):
getattr(spider, 'allowed_domains', []))
def url_has_any_extension(url, extensions):
- return posixpath.splitext(parse_url(url).path)[1].replace('.', '').lower() in extensions
+ return posixpath.splitext(parse_url(url).path)[1].lower() in extensions
def canonicalize_url(url, keep_blank_values=True, keep_fragments=False, \
encoding=None):