[Xfce4-commits] <thunar:master> Improve generating remote display names (bug #9442).

Nick Schermer noreply at xfce.org
Wed Nov 7 20:30:01 CET 2012


Updating branch refs/heads/master
         to c7a5a8dfb5379995af90b819fcffe2b8dad0ab7b (commit)
       from c4d27daa3178488737f202a21a095408985e7fb9 (commit)

commit c7a5a8dfb5379995af90b819fcffe2b8dad0ab7b
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Nov 7 20:28:02 2012 +0100

    Improve generating remote display names (bug #9442).
    
    Be safer with port numbers and such.

 thunar/thunar-gio-extensions.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/thunar/thunar-gio-extensions.c b/thunar/thunar-gio-extensions.c
index 1fd3bef..b4da684 100644
--- a/thunar/thunar-gio-extensions.c
+++ b/thunar/thunar-gio-extensions.c
@@ -267,7 +267,8 @@ thunar_g_file_get_display_name_remote (GFile *mount_point)
   gchar       *hostname;
   gchar       *display_name = NULL;
   const gchar *skip;
-  const gchar  skip_chars[] = G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT;
+  const gchar *firstdot;
+  const gchar  skip_chars[] = ":@";
   guint        n;
 
   _thunar_return_val_if_fail (G_IS_FILE (mount_point), NULL);
@@ -287,13 +288,19 @@ thunar_g_file_get_display_name_remote (GFile *mount_point)
 
           /* goto path part */
           path = strchr (p, '/');
+          firstdot = strchr (p, '.');
 
-          /* skip password or login names in the hostname */
-          for (n = 0; n < G_N_ELEMENTS (skip_chars) - 1; n++)
+          if (firstdot != NULL)
             {
-              skip = strchr (p, skip_chars[n]);
-              if (skip != NULL && (path == NULL || skip < path))
-                p = skip + 1;
+              /* skip password or login names in the hostname */
+              for (n = 0; n < G_N_ELEMENTS (skip_chars) - 1; n++)
+                {
+                  skip = strchr (p, skip_chars[n]);
+                  if (skip != NULL
+                       && (path == NULL || skip < path)
+                       && (skip < firstdot))
+                    p = skip + 1;
+                }
             }
 
           /* extract the path and hostname from the string */


More information about the Xfce4-commits mailing list