diff options
author | Jesús Bravo Álvarez <bugs@suso.me> | 2011-10-06 22:21:24 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-10-06 22:21:24 +0200 |
commit | 039b3544902fe479fa2ce31f06de2c08377e0fc5 (patch) | |
tree | ced1e3ccfec40bf3f57f1fc4fc1edb0a20004f42 | |
parent | b2f03e76ffd3af918d8eda0968f54c0b81bbff54 (diff) | |
download | mpd-039b3544902fe479fa2ce31f06de2c08377e0fc5.tar.gz mpd-039b3544902fe479fa2ce31f06de2c08377e0fc5.tar.xz mpd-039b3544902fe479fa2ce31f06de2c08377e0fc5.zip |
playlist_song: fix absolute path support in playlists
Right now, a playlist with absolute pathnames can only add songs that
are in the same the directory of the playlist or under it.
If uri is an absolute pathname and base_uri is set,
playlist_check_translate_song() will check that base_uri is a prefix
of uri, excluding every other song in the music directory outside
base_uri.
I think in this case base_uri should be completely ignored (and made
NULL) and uri should just be checked against music root directory.
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/playlist_song.c | 5 |
2 files changed, 3 insertions, 3 deletions
@@ -15,6 +15,7 @@ ver 0.16.5 (2010/??/??) - the "seek" command works when MPD is stopped - restore song position from state file (bug fix) - fix crash that sometimes occurred when audio device fails on startup + - fix absolute path support in playlists * WIN32: close sockets properly * install systemd service file if systemd is available diff --git a/src/playlist_song.c b/src/playlist_song.c index 1a543a0b8..827098655 100644 --- a/src/playlist_song.c +++ b/src/playlist_song.c @@ -114,9 +114,7 @@ playlist_check_translate_song(struct song *song, const char *base_uri) if (g_path_is_absolute(uri)) { /* XXX fs_charset vs utf8? */ - char *prefix = base_uri != NULL - ? map_uri_fs(base_uri) - : map_directory_fs(db_get_root()); + char *prefix = map_directory_fs(db_get_root()); if (prefix == NULL || !g_str_has_prefix(uri, prefix) || uri[strlen(prefix)] != '/') { @@ -127,6 +125,7 @@ playlist_check_translate_song(struct song *song, const char *base_uri) return NULL; } + base_uri = NULL; uri += strlen(prefix) + 1; g_free(prefix); } |