diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2012-01-06 19:17:59 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2012-01-06 19:17:59 (GMT) |
commit | 857d4cf2a26fe8683276180f18a82eaa1779163c (patch) | |
tree | 72d0687989a772c6ca58745a96863d9aa96b2621 | |
parent | 0aaaeb41ec54edf11aa33e4e26b42095140e7a7d (diff) |
Fix image downloading. If is downloading from upload.wikimedia.org don't add the page source url
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
-rw-r--r-- | net.py | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -82,7 +82,9 @@ def image_handler(root, uid, document): image_title = path.rsplit("/", 1)[-1] # attempt to fix incomplete paths if (not path.startswith("http://")) and document.source != None and document.source.has_key("href"): - if path.startswith("/"): + if path.startswith("//upload"): + path = 'http:' + path + elif path.startswith("/"): path = document.source['href'].rsplit("/", 1)[0] + path else: path = document.source['href'].rsplit("/", 1)[0] + "/" + path |