Reordering is incorrect when duplicate URIs exist #15
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaroheinonen/my-spotify-playlist-sorter-go#15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
ReorderPlaylistTracks()stores only one current index per URI. Each duplicate occurrence overwrites the preceding occurrence inindexMap.For some duplicate orders, the lookup returns an index before the current destination position. The local shifting loop at
/internal/spotify/playlist.go#L203handles onlytargetIndex > i, so it can overwrite entries in its local representation and issue subsequent reorder requests with incorrect positions.Using original order
[A, B, A, C, A]and desired order[A, A, A, B, C]against a Spotify-shaped test server, the function returned success but corrupted its local order to[A, A, A, A, C].