[Sugar-devel] [Infoslicer] Fix image downloading. If is downloading from upload.wikimedia.org don't add the page source url

Walter Bender walter.bender at gmail.com
Fri Jan 6 14:41:04 EST 2012


On Fri, Jan 6, 2012 at 2:22 PM,  <godiard at sugarlabs.org> wrote:
> From: Gonzalo Odiard <godiard at gmail.com>
>
> Signed-off-by: Gonzalo Odiard <gonzalo at laptop.org>
> ---
>  net.py |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/net.py b/net.py
> index 98589f1..e3a13cf 100644
> --- a/net.py
> +++ b/net.py
> @@ -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
> --
> 1.7.7.5
>

Looks good.

-walter

-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org


More information about the Sugar-devel mailing list