[gnome-desktop] thumbnailer: Fix extension computation for dotfiles



commit e9eb621a9282928173f8e81a903656e88ab83c42
Author: daniel <daniel mohns posteo de>
Date:   Wed May 15 19:15:08 2019 +0200

    thumbnailer: Fix extension computation for dotfiles
    
    It is common practise to consider dotfiles like `.cshrc` as
    extension-less files. Also, directories should be considered
    extension-less regardless of whether or not they have any amount of
    periods in their filename. Scope of this commit it to mirror this
    behaviour.

 libgnome-desktop/gnome-desktop-thumbnail-script.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/libgnome-desktop/gnome-desktop-thumbnail-script.c 
b/libgnome-desktop/gnome-desktop-thumbnail-script.c
index 8e8b8765..79419760 100644
--- a/libgnome-desktop/gnome-desktop-thumbnail-script.c
+++ b/libgnome-desktop/gnome-desktop-thumbnail-script.c
@@ -149,7 +149,9 @@ get_extension (const char *path)
 
   basename = g_path_get_basename (path);
   p = strrchr (basename, '.');
-  if (p == NULL)
+  if (g_file_test (path, G_FILE_TEST_IS_DIR) ||
+      !p ||
+      p == basename) /* Leading periods on the basename are ignored. */
     return NULL;
   return g_strdup (p + 1);
 }


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