Fix bug #3126 “libravatar: do not collect empty files”
[claws.git] / src / plugins / libravatar / libravatar.c
index 02559207c4358dbfd38c7a6761b774f4c802afcf..a7f9827951e5194b0bec607967626d4104a00dbf 100644 (file)
@@ -154,7 +154,8 @@ static GtkWidget *image_widget_from_url(const gchar *url, const gchar *md5)
                long filesize;
 
                if (libravatarprefs.allow_redirects) {
-                       long maxredirs = (libravatarprefs.default_mode == DEF_MODE_MM)? 2L: 1L;
+                       long maxredirs = (libravatarprefs.default_mode == DEF_MODE_URL)? 3L
+                               : ((libravatarprefs.default_mode == DEF_MODE_MM)? 2L: 1L);
 
                        curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
                        curl_easy_setopt(curl, CURLOPT_MAXREDIRS, maxredirs);
@@ -170,7 +171,7 @@ static GtkWidget *image_widget_from_url(const gchar *url, const gchar *md5)
                else
                        image = image_widget_from_filename(filename);
 
-               if (!libravatarprefs.cache_icons) {
+               if (!libravatarprefs.cache_icons || filesize == 0) {
                        if (g_unlink(filename) < 0)
                                g_warning("failed to delete cache file %s\n", filename);
                }
@@ -440,9 +441,9 @@ const gchar *plugin_desc(void)
                 "a gravatar.com profile but not a libravatar one, those will also\n"
                 "be retrieved (when redirections are allowed in plugin config).\n"
                 "Plugin config page it's available from main window at:\n"
-                "Configuration→Preferences→Plugins→Libravatar.\n\n"
+                "/Configuration/Preferences/Plugins/Libravatar.\n\n"
                 "This plugin uses libcurl to retrieve images, so if you're behind a\n"
-                "proxy please refer to curl(1) manpage for details on ‘http_proxy’\n"
+                "proxy please refer to curl(1) manpage for details on 'http_proxy'\n"
                 "configuration. More details about this and others on README file.\n\n"
                 "Feedback to <ricardo@mones.org> is welcome.\n");
 }