mirror of https://github.com/scrapy/scrapy.git
[#744] Ensure domain is not None before building regex
This commit is contained in:
parent
ad11fc01cb
commit
eefa878f98
|
|
@ -49,7 +49,7 @@ class OffsiteMiddleware(object):
|
|||
allowed_domains = getattr(spider, 'allowed_domains', None)
|
||||
if not allowed_domains:
|
||||
return re.compile('') # allow all by default
|
||||
regex = r'^(.*\.)?(%s)$' % '|'.join(re.escape(d) for d in allowed_domains)
|
||||
regex = r'^(.*\.)?(%s)$' % '|'.join(re.escape(d) for d in allowed_domains if d is not None)
|
||||
return re.compile(regex)
|
||||
|
||||
def spider_opened(self, spider):
|
||||
|
|
|
|||
Loading…
Reference in New Issue