playlist_queue: convert absolute paths
Accept absolute paths if they point into the music directory.
This commit is contained in:
@@ -102,10 +102,22 @@ check_translate_song(struct song *song, const char *base_uri)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (g_path_is_absolute(uri)) {
|
if (g_path_is_absolute(uri)) {
|
||||||
/* local files must be relative to the music
|
/* XXX fs_charset vs utf8? */
|
||||||
directory */
|
char *prefix = base_uri != NULL
|
||||||
song_free(song);
|
? map_uri_fs(base_uri)
|
||||||
return NULL;
|
: map_directory_fs(db_get_root());
|
||||||
|
|
||||||
|
if (prefix == NULL || !g_str_has_prefix(uri, prefix) ||
|
||||||
|
uri[strlen(prefix)] != '/') {
|
||||||
|
/* local files must be relative to the music
|
||||||
|
directory */
|
||||||
|
g_free(prefix);
|
||||||
|
song_free(song);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
uri += strlen(prefix) + 1;
|
||||||
|
g_free(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (base_uri != NULL)
|
if (base_uri != NULL)
|
||||||
|
Reference in New Issue
Block a user