[file-roller] Fixed bug that prevented to add files with spaces



commit 1e38c5df005ec2d54ac05b3028ab7c56a09ad082
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Aug 17 20:08:43 2009 +0200

    Fixed bug that prevented to add files with spaces
    
    Unescape the file uri where required
    
    [fixed bug #589920]

 src/fr-archive.c |   10 +++++++---
 src/gio-utils.c  |   15 ++++++++-------
 2 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/src/fr-archive.c b/src/fr-archive.c
index 79ea86b..db62454 100644
--- a/src/fr-archive.c
+++ b/src/fr-archive.c
@@ -1846,8 +1846,12 @@ add_dropped_items (DroppedItemsData *data)
 
 		first_basedir = remove_level_from_path (list->data);
 
-		for (scan = list; scan; scan = scan->next)
-			only_names_list = g_list_prepend (only_names_list, (gpointer) file_name_from_path (scan->data));
+		for (scan = list; scan; scan = scan->next) {
+			char *name;
+
+			name = g_uri_unescape_string (file_name_from_path (scan->data), NULL);
+			only_names_list = g_list_prepend (only_names_list, name);
+		}
 
 		fr_archive_add_files (archive,
 				      only_names_list,
@@ -1859,7 +1863,7 @@ add_dropped_items (DroppedItemsData *data)
 				      data->compression,
 				      data->volume_size);
 
-		g_list_free (only_names_list);
+		path_list_free (only_names_list);
 		g_free (first_basedir);
 
 		return;
diff --git a/src/gio-utils.c b/src/gio-utils.c
index 9b5c97b..f94e94f 100644
--- a/src/gio-utils.c
+++ b/src/gio-utils.c
@@ -495,8 +495,9 @@ get_relative_file_list (GList      *rel_list,
 
 	for (scan = file_list; scan; scan = scan->next) {
 		char *full_path = scan->data;
+
 		if (path_in_path (base_dir, full_path)) {
-			char *rel_path = g_strdup (full_path + base_len + 1);
+			char *rel_path = g_uri_unescape_string (full_path + base_len + 1, NULL);
 			rel_list = g_list_prepend (rel_list, rel_path);
 		}
 	}
@@ -518,7 +519,7 @@ get_dir_list_from_file_list (GHashTable *h_dirs,
 	if (base_dir == NULL)
 		base_dir = "";
 	base_dir_len = strlen (base_dir);
-	
+
 	for (scan = files; scan; scan = scan->next) {
 		char *filename = scan->data;
 		char *dir_name;
@@ -635,7 +636,7 @@ get_file_list_for_each_file (const char *uri,
 	switch (g_file_info_get_file_type (info)) {
 	case G_FILE_TYPE_REGULAR:
 		if (filter_matches (gfl->include_filter, uri))
-			if ((gfl->exclude_filter->pattern == NULL) || ! filter_matches (gfl->exclude_filter, uri)) 
+			if ((gfl->exclude_filter->pattern == NULL) || ! filter_matches (gfl->exclude_filter, uri))
 				gfl->files = g_list_prepend (gfl->files, g_strdup (uri));
 		break;
 	default:
@@ -809,14 +810,14 @@ g_list_items_async (GList             *items,
 		base_len = strlen (base_dir);
 
 	for (scan = items; scan; scan = scan->next) {
-		char *path = scan->data;
+		char *uri = scan->data;
 
 		/* FIXME: this is not async */
-		if (uri_is_dir (path)) {
-			gfl->to_visit = g_list_prepend (gfl->to_visit, g_strdup (path));
+		if (uri_is_dir (uri)) {
+			gfl->to_visit = g_list_prepend (gfl->to_visit, g_strdup (uri));
 		}
 		else {
-			char *rel_path = g_strdup (path + base_len + 1);
+			char *rel_path = g_uri_unescape_string (uri + base_len + 1, NULL);
 			gfl->files = g_list_prepend (gfl->files, rel_path);
 		}
 	}



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