Merge branch '470-url-encoding' into 'develop'

Fix #470: Properly encode Wikipedia and lyrics search urls

Closes #470

See merge request funkwhale/funkwhale!449
This commit is contained in:
Eliot Berriot 2018-10-20 14:22:06 +00:00
commit a30136d26d
4 changed files with 5 additions and 4 deletions

View File

@ -0,0 +1 @@
Properly encode Wikipedia and lyrics search urls (#470)

View File

@ -102,7 +102,7 @@ export default {
} }
}, },
wikipediaUrl () { wikipediaUrl () {
return 'https://en.wikipedia.org/w/index.php?search=' + this.album.title + ' ' + this.album.artist.name return 'https://en.wikipedia.org/w/index.php?search=' + encodeURI(this.album.title + ' ' + this.album.artist.name)
}, },
musicbrainzUrl () { musicbrainzUrl () {
return 'https://musicbrainz.org/release/' + this.album.mbid return 'https://musicbrainz.org/release/' + this.album.mbid

View File

@ -151,7 +151,7 @@ export default {
}).length > 0 }).length > 0
}, },
wikipediaUrl () { wikipediaUrl () {
return 'https://en.wikipedia.org/w/index.php?search=' + this.artist.name return 'https://en.wikipedia.org/w/index.php?search=' + encodeURI(this.artist.name)
}, },
musicbrainzUrl () { musicbrainzUrl () {
return 'https://musicbrainz.org/artist/' + this.artist.mbid return 'https://musicbrainz.org/artist/' + this.artist.mbid

View File

@ -196,7 +196,7 @@ export default {
} }
}, },
wikipediaUrl () { wikipediaUrl () {
return 'https://en.wikipedia.org/w/index.php?search=' + this.track.title + ' ' + this.track.artist.name return 'https://en.wikipedia.org/w/index.php?search=' + encodeURI(this.track.title + ' ' + this.track.artist.name)
}, },
musicbrainzUrl () { musicbrainzUrl () {
return 'https://musicbrainz.org/recording/' + this.track.mbid return 'https://musicbrainz.org/recording/' + this.track.mbid
@ -211,7 +211,7 @@ export default {
lyricsSearchUrl () { lyricsSearchUrl () {
let base = 'http://lyrics.wikia.com/wiki/Special:Search?query=' let base = 'http://lyrics.wikia.com/wiki/Special:Search?query='
let query = this.track.artist.name + ' ' + this.track.title let query = this.track.artist.name + ' ' + this.track.title
return base + query return base + encodeURI(query)
}, },
cover () { cover () {
return null return null