[Commits] [SCM] claws branch, master, updated. 3.17.5-24-g4ed9411f4

mones at claws-mail.org mones at claws-mail.org
Sun Jun 21 19:42:21 CEST 2020


The branch, master has been updated
       via  4ed9411f4dc2801d7f983734ae4003102b8f361d (commit)
       via  3fdfe990c6976d2e5b41b27655dc3c4da5bccb94 (commit)
      from  abfab6860f3edb8b3d7526804c2373db11fe3f6b (commit)

Summary of changes:
 src/plugins/libravatar/libravatar_image.c | 12 +++++++++---
 src/plugins/libravatar/libravatar_prefs.c |  9 +++++++++
 src/plugins/libravatar/libravatar_prefs.h |  3 +++
 3 files changed, 21 insertions(+), 3 deletions(-)


- Log -----------------------------------------------------------------
commit 4ed9411f4dc2801d7f983734ae4003102b8f361d
Author: Ricardo Mones <ricardo at mones.org>
Date:   Sun Jun 21 19:41:40 2020 +0200

    Fix bug 4220 "generates files in cache without content"
    
    Also replace "safe" call, since file should not be locked and is
    going to be deleted anyway.

diff --git a/src/plugins/libravatar/libravatar_image.c b/src/plugins/libravatar/libravatar_image.c
index b5675aac2..6d0fdac76 100644
--- a/src/plugins/libravatar/libravatar_image.c
+++ b/src/plugins/libravatar/libravatar_image.c
@@ -83,6 +83,7 @@ static GdkPixbuf *pixbuf_from_url(const gchar *url, const gchar *md5, const gcha
 	curl = curl_easy_init();
 	if (curl == NULL) {
 		g_warning("could not initialize curl to get image from URL");
+		unlink(filename);
 		claws_fclose(file);
 		return NULL;
 	}
@@ -113,7 +114,8 @@ static GdkPixbuf *pixbuf_from_url(const gchar *url, const gchar *md5, const gcha
 	res = curl_easy_perform(curl);
 	if (res != CURLE_OK) {
 		debug_print("curl_easy_perfom failed: %s", curl_easy_strerror(res));
-		claws_safe_fclose(file);
+		unlink(filename);
+		claws_fclose(file);
 	} else {
 		filesize = ftell(file);
 		claws_safe_fclose(file);

commit 3fdfe990c6976d2e5b41b27655dc3c4da5bccb94
Author: Ricardo Mones <ricardo at mones.org>
Date:   Sun Jun 21 19:40:59 2020 +0200

    Fix bug 4325 "Following redirects when retrieving image"
    
    Previously hardcoded numbers are now raised to cope with libravatar
    servers changes and also moved into 3 new hidden preferences for the
    plugin, for future customisation if required.

diff --git a/src/plugins/libravatar/libravatar_image.c b/src/plugins/libravatar/libravatar_image.c
index 057569a0f..b5675aac2 100644
--- a/src/plugins/libravatar/libravatar_image.c
+++ b/src/plugins/libravatar/libravatar_image.c
@@ -99,8 +99,12 @@ static GdkPixbuf *pixbuf_from_url(const gchar *url, const gchar *md5, const gcha
 	curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
 
 	if (libravatarprefs.allow_redirects) {
-		long maxredirs = (libravatarprefs.default_mode == DEF_MODE_URL)? 3L
-			: ((libravatarprefs.default_mode == DEF_MODE_MM)? 2L: 1L);
+		long maxredirs = (libravatarprefs.default_mode == DEF_MODE_URL)
+			? libravatarprefs.max_redirects_url
+			: ((libravatarprefs.default_mode == DEF_MODE_MM)
+				? libravatarprefs.max_redirects_mm
+				: libravatarprefs.max_redirects_url);
+		debug_print("setting max redirects to %ld\n", maxredirs);
 		curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
 		curl_easy_setopt(curl, CURLOPT_MAXREDIRS, maxredirs);
 	}
diff --git a/src/plugins/libravatar/libravatar_prefs.c b/src/plugins/libravatar/libravatar_prefs.c
index 3183def94..3a097001b 100644
--- a/src/plugins/libravatar/libravatar_prefs.c
+++ b/src/plugins/libravatar/libravatar_prefs.c
@@ -93,6 +93,15 @@ static PrefParam param[] = {
 	{ "timeout", "0",
 	  &libravatarprefs.timeout,
           P_INT, NULL, NULL, NULL },
+	{ "max_redirects_url", "7",
+	  &libravatarprefs.max_redirects_url,
+          P_INT, NULL, NULL, NULL },
+	{ "max_redirects_mm", "5",
+	  &libravatarprefs.max_redirects_mm,
+          P_INT, NULL, NULL, NULL },
+	{ "max_redirects", "3",
+	  &libravatarprefs.max_redirects,
+          P_INT, NULL, NULL, NULL },
 	{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
 };
 
diff --git a/src/plugins/libravatar/libravatar_prefs.h b/src/plugins/libravatar/libravatar_prefs.h
index 49be9645d..2e4cb93c3 100644
--- a/src/plugins/libravatar/libravatar_prefs.h
+++ b/src/plugins/libravatar/libravatar_prefs.h
@@ -48,6 +48,9 @@ struct _LibravatarPrefs
 	gboolean	allow_federated;
 #endif
 	guint		timeout;
+	guint		max_redirects_url; /* hidden pref */
+	guint		max_redirects_mm; /* hidden pref */
+	guint		max_redirects;   /* hidden pref */
 };
 
 extern LibravatarPrefs libravatarprefs;

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list