stored_playlist: don't map files outside the database

Don't attempt to map paths which are already absolute with
map_song_fs(): check with song_in_database() instead of
song_is_file().
This commit is contained in:
Max Kellermann
2008-10-23 09:54:42 +02:00
parent fdc9a4cc5a
commit 4f807b3aaa

View File

@@ -29,7 +29,7 @@ playlist_print_song(FILE *file, const struct song *song)
{ {
char tmp1[MPD_PATH_MAX], tmp2[MPD_PATH_MAX]; char tmp1[MPD_PATH_MAX], tmp2[MPD_PATH_MAX];
if (playlist_saveAbsolutePaths && song_is_file(song)) { if (playlist_saveAbsolutePaths && song_in_database(song)) {
const char *path = map_song_fs(song, tmp1); const char *path = map_song_fs(song, tmp1);
if (path != NULL) if (path != NULL)
fprintf(file, "%s\n", path); fprintf(file, "%s\n", path);
@@ -46,7 +46,8 @@ playlist_print_uri(FILE *file, const char *uri)
char tmp[MPD_PATH_MAX]; char tmp[MPD_PATH_MAX];
const char *s; const char *s;
if (playlist_saveAbsolutePaths && !isValidRemoteUtf8Url(uri)) if (playlist_saveAbsolutePaths && !isValidRemoteUtf8Url(uri) &&
uri[0] != '/')
s = map_directory_child_fs(db_get_root(), uri, tmp); s = map_directory_child_fs(db_get_root(), uri, tmp);
else else
s = utf8_to_fs_charset(tmp, uri); s = utf8_to_fs_charset(tmp, uri);