--- tumbler-0.2.3.orig/tumblerd/tumbler-registry.c 2018-09-12 08:34:53.000000000 +0200 +++ tumbler-0.2.3/tumblerd/tumbler-registry.c 2018-10-20 10:01:14.036706000 +0200 @@ -465,38 +465,12 @@ /* iterate over all URIs */ for (n = 0; n < length; ++n) { - gchar *filename; - struct stat sb; - + g_assert (TUMBLER_IS_FILE_INFO (infos[n])); /* reset */ file_size = 0; - filename = g_filename_from_uri (tumbler_file_info_get_uri (infos[n]), NULL, NULL); - - if (G_LIKELY(filename)) - { - stat (filename, &sb); - - g_free (filename); - - /* Test sparse files on regular ones */ - if (S_ISREG (sb.st_mode)) - { - if (((TUMBLER_STAT_BLKSIZE * sb.st_blocks) / sb.st_size) < 0.8) - { - g_debug ("'%s' is probably a sparse file, skipping\n", tumbler_file_info_get_uri (infos[n])); - continue; - } - } - } - else - { - g_warning ("Failed to get filename from uri for '%s', skipping\n", tumbler_file_info_get_uri (infos[n])); - continue; - } - /* determine the URI scheme and generate a hash key */ gfile = g_file_new_for_uri (tumbler_file_info_get_uri (infos[n])); scheme = g_file_get_uri_scheme (gfile); @@ -507,6 +481,8 @@ list = tumbler_registry_lookup (registry, hash_key); for (lp = list; lp != NULL; lp = lp->next) { + gchar *filename; + struct stat sb; /* check if the file size is a limitation */ max_file_size = tumbler_thumbnailer_get_max_file_size (lp->data); if (max_file_size > 0) @@ -518,6 +494,30 @@ continue; } + /* check if the file is sparse */ + if (g_file_is_native (gfile)) + { + filename = g_filename_from_uri (tumbler_file_info_get_uri (infos[n]), NULL, NULL); + if (G_LIKELY(filename)) + { + stat (filename, &sb); + g_free (filename); + /* Test sparse files on regular ones */ + if (S_ISREG (sb.st_mode)) + { + if (((TUMBLER_STAT_BLKSIZE * sb.st_blocks) / sb.st_size) < 0.8) + { + g_debug ("'%s' is probably a sparse file, skipping\n", tumbler_file_info_get_uri (infos[n])); + continue; + } + } + } + else + { + g_warning ("Failed to get filename from uri for '%s', skipping\n", tumbler_file_info_get_uri (infos[n])); + continue; + } + } /* check if the location is supported */ if (!tumbler_thumbnailer_supports_location (lp->data, gfile)) continue;