[gnome-software/gnome-3-14] screenshot image: Check if the URI passed to libsoup is valid



commit af2b9e7ccbf3efc57427d5e1269d09ffdf267d72
Author: Kalev Lember <klember redhat com>
Date:   Wed Jun 17 17:05:16 2015 +0200

    screenshot image: Check if the URI passed to libsoup is valid
    
    ... and bail out early if it's not.

 src/gs-screenshot-image.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-screenshot-image.c b/src/gs-screenshot-image.c
index 6c8140b..cc4585c 100644
--- a/src/gs-screenshot-image.c
+++ b/src/gs-screenshot-image.c
@@ -419,7 +419,7 @@ gs_screenshot_image_load_async (GsScreenshotImage *ssimg,
        /* download file */
        g_debug ("downloading %s to %s", url, priv->filename);
        base_uri = soup_uri_new (url);
-       if (base_uri == NULL) {
+       if (base_uri == NULL || !SOUP_URI_VALID_FOR_HTTP (base_uri)) {
                /* TRANSLATORS: this is when we try to download a screenshot
                 * that was not a valid URL */
                gs_screenshot_image_set_error (ssimg, _("Screenshot not valid"));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]