Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formatURI not working for parsed playlist #6

Closed
zhaobenny opened this issue Jan 19, 2020 · 3 comments
Closed

formatURI not working for parsed playlist #6

zhaobenny opened this issue Jan 19, 2020 · 3 comments

Comments

@zhaobenny
Copy link

var parsed = spotifyUri.parse("https://open.spotify.com/playlist/37i9dQZF1DWVqfgj8NZEp1?si=rEPRsn4NRzCW4Pzj_8ivog");
var uri = spotifyUri.formatURI(parsed);

gives error

..../node_modules/spotify-uri/formatURI.js:58
        return escape(str.replace(/ /g, '+'));
                          ^
TypeError: Cannot read property 'replace' of undefined
@miraclx
Copy link
Contributor

miraclx commented Feb 23, 2020

Just stumbled on this error too

Seems @TooTallNate's logic only formats for users playlists

spotify-uri/formatURI.js

Lines 26 to 29 in dff69e9

} else if ('playlist' == parsed.type) {
// user "playlist"
return 'spotify:user:' + encode(parsed.user) + ':playlist:' + parsed.id;
} else if ('local' == parsed.type) {

Opening a pull request...

@miraclx
Copy link
Contributor

miraclx commented Feb 23, 2020

Until the author merges this pull request you could rebase here

npm install git://github.com/miraclx/spotify-uri#patch-1

@TooTallNate
Copy link
Owner

Fixed in v1.1.0. Thanks @miraclx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants