[gnome-software] Load the small thumbnail if available when loading screenshots



commit 8e15d26c5cef45b71c3b54208a1c9558d5d63d1e
Author: Richard Hughes <richard hughsie com>
Date:   Tue May 31 11:54:52 2016 +0100

    Load the small thumbnail if available when loading screenshots
    
    This broke when we switched to sha256'ing the URL for security, but if we do
    this we need to hash the _correct_ url for the thumbnail, not the URL for the
    main image as they may have a different URL path.

 src/gs-screenshot-image.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-screenshot-image.c b/src/gs-screenshot-image.c
index f56731d..661b157 100644
--- a/src/gs-screenshot-image.c
+++ b/src/gs-screenshot-image.c
@@ -416,10 +416,17 @@ gs_screenshot_image_load_async (GsScreenshotImage *ssimg,
        /* can we load a blurred smaller version of this straight away */
        if (ssimg->width > AS_IMAGE_THUMBNAIL_WIDTH &&
            ssimg->height > AS_IMAGE_THUMBNAIL_HEIGHT) {
+               const gchar *url_thumb;
+               g_autofree gchar *basename_thumb = NULL;
                g_autofree gchar *cache_kind_thumb = NULL;
+               im = as_screenshot_get_image (ssimg->screenshot,
+                                             AS_IMAGE_THUMBNAIL_WIDTH * ssimg->scale,
+                                             AS_IMAGE_THUMBNAIL_HEIGHT * ssimg->scale);
+               url_thumb = as_image_get_url (im);
+               basename_thumb = gs_screenshot_get_cachefn_for_url (url_thumb);
                cache_kind_thumb = g_build_filename ("screenshots", "112x63", NULL);
                cachefn_thumb = gs_utils_get_cache_filename (cache_kind_thumb,
-                                                            basename,
+                                                            basename_thumb,
                                                             GS_UTILS_CACHE_FLAG_NONE,
                                                             NULL);
                if (cachefn_thumb == NULL)


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