From dfbb98b2c698ea84243f1f2f10ec0fb4be5973e4 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 29 Jan 2014 23:13:51 -0500 Subject: [PATCH] audio: Escape filepaths before loading This is for filepaths containing special characters. Signed-off-by: Anna Schumaker --- lib/audio.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/audio.cpp b/lib/audio.cpp index 8e8b0623..afa57ce4 100644 --- a/lib/audio.cpp +++ b/lib/audio.cpp @@ -83,7 +83,7 @@ static bool change_state(GstState state) static bool load_song(library :: Song &song) { GstState state; - gchar *escaped; + gchar *escaped, *uri; std::string filepath = song.library->root_path + "/" + song.track->filepath; if (o_should_pause == true) { @@ -95,9 +95,11 @@ static bool load_song(library :: Song &song) } change_state(GST_STATE_NULL); - escaped = gst_filename_to_uri(filepath.c_str(), NULL); - g_object_set(G_OBJECT(ocarina_player), "uri", escaped, NULL); + escaped = g_markup_escape_text(filepath.c_str(), filepath.size()); + uri = gst_filename_to_uri(escaped, NULL); + g_object_set(G_OBJECT(ocarina_player), "uri", uri, NULL); g_free(escaped); + g_free(uri); get_callbacks()->on_track_loaded(song); return change_state(state);