[rhythmbox] mtp: make filenames safe for FAT filesystems before transferring
- From: Jonathan Matthew <jmatthew src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rhythmbox] mtp: make filenames safe for FAT filesystems before transferring
- Date: Sun, 9 Aug 2009 08:09:52 +0000 (UTC)
commit bb77ce7e0958d7b95bbf0ef463318ef29d96e961
Author: Jonathan Matthew <jonathan d14n org>
Date: Sun Aug 9 18:09:06 2009 +1000
mtp: make filenames safe for FAT filesystems before transferring
lib/rb-file-helpers.c | 14 ++++++++++++--
lib/rb-file-helpers.h | 1 +
plugins/mtpdevice/rb-mtp-source.c | 1 +
3 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/lib/rb-file-helpers.c b/lib/rb-file-helpers.c
index f321936..0d9e701 100644
--- a/lib/rb-file-helpers.c
+++ b/lib/rb-file-helpers.c
@@ -1200,6 +1200,17 @@ rb_uri_get_filesystem_type (const char *uri)
}
/**
+ * rb_sanitize_path_for_msdos_filesystem:
+ * @path: a path to sanitize (modified in place)
+ */
+void
+rb_sanitize_path_for_msdos_filesystem (char *path)
+{
+ g_strdelimit (path, "\"", '\'');
+ g_strdelimit (path, ":|<>*?\\", '_');
+}
+
+/**
* rb_sanitize_uri_for_filesystem:
* @uri: a URI to sanitize
*
@@ -1229,8 +1240,7 @@ rb_sanitize_uri_for_filesystem (const char *uri)
return g_strdup (uri);
}
- g_strdelimit (full_path, "\"", '\'');
- g_strdelimit (full_path, ":|<>*?\\", '_');
+ rb_sanitize_path_for_msdos_filesystem (full_path);
/* create a new uri from this */
sane_uri = g_filename_to_uri (full_path, hostname, &error);
diff --git a/lib/rb-file-helpers.h b/lib/rb-file-helpers.h
index b894a74..d621ebd 100644
--- a/lib/rb-file-helpers.h
+++ b/lib/rb-file-helpers.h
@@ -95,6 +95,7 @@ void rb_file_helpers_init (gboolean uninstalled);
void rb_file_helpers_shutdown(void);
char * rb_uri_get_filesystem_type (const char *uri);
+void rb_sanitize_path_for_msdos_filesystem (char *path);
char * rb_sanitize_uri_for_filesystem(const char *uri);
G_END_DECLS
diff --git a/plugins/mtpdevice/rb-mtp-source.c b/plugins/mtpdevice/rb-mtp-source.c
index 20513de..37952a2 100644
--- a/plugins/mtpdevice/rb-mtp-source.c
+++ b/plugins/mtpdevice/rb-mtp-source.c
@@ -964,6 +964,7 @@ transfer_track (RBMtpSource *source,
trackmeta->artist = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_ARTIST);
trackmeta->genre = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_GENRE);
trackmeta->filename = g_path_get_basename (filename);
+ rb_sanitize_path_for_msdos_filesystem (trackmeta->filename);
if (rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_DATE) > 0) { /* Entries without a date returns 0, g_date_set_julian don't accept that */
g_date_set_julian (&d, rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_DATE));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]