diff --git a/dosagelib/comic.py b/dosagelib/comic.py index 8225fbbe2..0864e60b3 100755 --- a/dosagelib/comic.py +++ b/dosagelib/comic.py @@ -42,7 +42,7 @@ class ComicImage(object): """Set URL and filename.""" self.name = name self.referrer = referrer - self.url = url.strip() + self.url = url self.dirname = dirname filename = getFilename(filename) self.filename, self.ext = os.path.splitext(filename) diff --git a/dosagelib/util.py b/dosagelib/util.py index 8ad9b1836..73b02f2a1 100644 --- a/dosagelib/util.py +++ b/dosagelib/util.py @@ -270,10 +270,12 @@ def unescape(text): _nopathquote_chars = "-;/=,~*+()@!" def normaliseURL(url): - """Removes any leading empty segments to avoid breaking urllib2; also replaces - HTML entities and character references. + """Normalising + - strips and leading or trailing whitespace, + - replaces HTML entities and character references, + - removes any leading empty segments to avoid breaking urllib2. """ - url = unicode_safe(url) + url = unicode_safe(url).strip() # XXX: brutal hack url = unescape(url)