Fix bug in web2disk that caused download of some webpages that have empty hrefs to fail.

This commit is contained in:
Kovid Goyal 2008-03-24 20:57:26 +00:00
parent cc06c421c3
commit 4c30684322

View File

@ -49,7 +49,7 @@ def save_soup(soup, target):
for tag in soup.findAll(['img', 'link', 'a']):
for key in ('src', 'href'):
path = tag.get(key, None)
if path and os.path.exists(path) and os.path.isabs(path):
if path and os.path.isfile(path) and os.path.exists(path) and os.path.isabs(path):
tag[key] = relpath(path, selfdir).replace(os.sep, '/')
f = codecs.open(target, 'w', 'utf-8')