aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-10-05 17:01:04 +0200
committerMax Kellermann <max@duempel.org>2012-10-05 17:01:04 +0200
commit8fb20fcdf8e2c04c385d868dd791be0d1fa2b045 (patch)
tree180d1dd5be568b6b7a3f18e9d6856ad6bd10dff4 /src
parent72bf2266085449d5549dbce98582ec564294ea21 (diff)
downloadmpd-8fb20fcdf8e2c04c385d868dd791be0d1fa2b045.tar.gz
mpd-8fb20fcdf8e2c04c385d868dd791be0d1fa2b045.tar.xz
mpd-8fb20fcdf8e2c04c385d868dd791be0d1fa2b045.zip
playlist_song: fix potential charset bug in apply_song_metadata()
The song's URI must be UTF-8, not filesystem character set.
Diffstat (limited to 'src')
-rw-r--r--src/playlist_song.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/playlist_song.c b/src/playlist_song.c
index 29efef2e3..a3d9ab4d9 100644
--- a/src/playlist_song.c
+++ b/src/playlist_song.c
@@ -23,6 +23,7 @@
#include "mapper.h"
#include "song.h"
#include "uri.h"
+#include "path.h"
#include "ls.h"
#include "tag.h"
@@ -62,8 +63,14 @@ apply_song_metadata(struct song *dest, const struct song *src)
if (path_fs == NULL)
return dest;
- tmp = song_file_new(path_fs, NULL);
- g_free(path_fs);
+ char *path_utf8 = fs_charset_to_utf8(path_fs);
+ if (path_utf8 != NULL)
+ g_free(path_fs);
+ else
+ path_utf8 = path_fs;
+
+ tmp = song_file_new(path_utf8, NULL);
+ g_free(path_utf8);
merge_song_metadata(tmp, dest, src);
} else {