From 1079ab8317b63767b2600e1fb2653e00926930c9 Mon Sep 17 00:00:00 2001 Message-Id: <1079ab8317b63767b2600e1fb2653e00926930c9.1374908341.git.jshipley@fastmail.fm> In-Reply-To: References: From: Jeff Shipley Date: Sat, 27 Jul 2013 00:57:25 -0600 Subject: [PATCH 8/8] Never return entire filename as an extension --- thunar/thunar-util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/thunar/thunar-util.c b/thunar/thunar-util.c index 77a36f9..a57fd2f 100644 --- a/thunar/thunar-util.c +++ b/thunar/thunar-util.c @@ -119,7 +119,7 @@ thunar_util_str_get_extension (const gchar *filename) /* check if there is an possible extension part in the name */ dot = strrchr (filename, '.'); - if (dot == NULL || dot[1] == '\0') + if (dot == NULL || dot == filename || dot[1] == '\0') return NULL; /* skip the . */ @@ -132,7 +132,7 @@ thunar_util_str_get_extension (const gchar *filename) { /* look for a possible container part (tar, psd, epsf) */ dot2 = thunar_util_strrchr_offset (filename, dot - 1, '.'); - if (dot2 != NULL) + if (dot2 != NULL && dot2 != filename) { /* check the 2nd part range, keep it between 2 and 5 chars */ len = dot - dot2 - 1; @@ -154,7 +154,7 @@ thunar_util_str_get_extension (const gchar *filename) dot2 = thunar_util_strrchr_offset (filename, dot - 1, '.'); /* the extension before .in could be long. check that it's at least 2 chars */ len = dot - dot2 - 1; - if (dot2 == NULL || len < 2) + if (dot2 == NULL || dot2 == filename || len < 2) break; /* continue if another .in was found */ -- 1.7.9.5