From 76959d8f951f10d54d69f01ed023a226f1e5299f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 30 Apr 2007 23:36:07 +0000 Subject: [PATCH] Unquote URLs for images and stylesheets. Fixes # --- src/libprs500/lrf/html/convert_from.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libprs500/lrf/html/convert_from.py b/src/libprs500/lrf/html/convert_from.py index c54f2bc5db..361407bc56 100644 --- a/src/libprs500/lrf/html/convert_from.py +++ b/src/libprs500/lrf/html/convert_from.py @@ -610,7 +610,7 @@ class HTMLConverter(object): self.add_text('Link: '+tag['href'], tag_css) self.links.append(HTMLConverter.Link(self.current_para.contents[-1], tag)) elif tagname == 'img': - if tag.has_key('src') and os.access(tag['src'], os.R_OK): + if tag.has_key('src') and os.access(unquote(tag['src']), os.R_OK): width, height = self.page_width, self.page_height try: try: @@ -618,7 +618,7 @@ class HTMLConverter(object): except: pass else: - im = PILImage.open(tag['src']) + im = PILImage.open(unquote(tag['src'])) width, height = im.size if tag.has_key('width'): width = int(tag['width']) @@ -626,7 +626,7 @@ class HTMLConverter(object): height = int(tag['height']) except: pass - path = os.path.abspath(tag['src']) + path = os.path.abspath(unquote(tag['src'])) if not self.images.has_key(path): self.images[path] = ImageStream(path) if max(width, height) <= min(self.page_width, self.page_height)/5.: @@ -647,7 +647,7 @@ class HTMLConverter(object): xsize=width, ysize=height) self.current_page.append(im) else: - print >>sys.stderr, "Failed to process", tag + print >>sys.stderr, "Failed to process:", tag self.add_image_page(tag['src']) elif tagname in ['style', 'link']: @@ -662,7 +662,7 @@ class HTMLConverter(object): if url.startswith('http://'): f = urlopen(url) else: - f = open(url) + f = open(unquote(url)) self.parse_css(f.read()) f.close() except IOError: