musikr: pin dotdot resolution of playlist entries
This commit is contained in:
@@ -94,6 +94,40 @@ class PlaylistPathResolverTest {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun resolve_dotdotEntries_escapeThePlaylistDirectory() {
|
||||||
|
val volume = FakeVolume()
|
||||||
|
val playlistDir = Path(volume, Components.parseUnix("Music/Playlists"))
|
||||||
|
val musicRoot = Path(volume, Components.parseUnix("Music"))
|
||||||
|
val library =
|
||||||
|
setOf(
|
||||||
|
Path(volume, Components.parseUnix("Music/Library/Artist/a.mp3")),
|
||||||
|
Path(volume, Components.parseUnix("Music/Library/Artist/b.mp3")),
|
||||||
|
)
|
||||||
|
val entries =
|
||||||
|
listOf(
|
||||||
|
PlaylistPathResolver.Entry(
|
||||||
|
Components.parseUnix("../Library/Artist/a.mp3"), absolute = false
|
||||||
|
),
|
||||||
|
PlaylistPathResolver.Entry(
|
||||||
|
Components.parseUnix("../Library/Artist/b.mp3"), absolute = false
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
val resolved =
|
||||||
|
PlaylistPathResolver().resolve(entries, listOf(playlistDir, musicRoot)) {
|
||||||
|
it in library
|
||||||
|
}
|
||||||
|
|
||||||
|
assertEquals(
|
||||||
|
listOf(
|
||||||
|
Path(volume, Components.parseUnix("Music/Library/Artist/a.mp3")),
|
||||||
|
Path(volume, Components.parseUnix("Music/Library/Artist/b.mp3")),
|
||||||
|
),
|
||||||
|
resolved,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private class FakeVolume : Volume.External {
|
private class FakeVolume : Volume.External {
|
||||||
override val mediaStoreName = "fake"
|
override val mediaStoreName = "fake"
|
||||||
override val id = "fake"
|
override val id = "fake"
|
||||||
|
|||||||
Reference in New Issue
Block a user