sentriz / gonic

music streaming server / free-software subsonic server API implementation
ircs://irc.libera.chat/#gonic
GNU General Public License v3.0
1.49k stars 105 forks source link

Last.fm Artist Lookup not sanitizing special characters in Artist's names #472

Closed flkdnt closed 4 months ago

flkdnt commented 4 months ago

gonic version:v0.16.2 if from docker, docker tag: latest

Hello,

I've noticed that the Last.fm Artist lookup will fail(rendering a default image) in the following cases:

  1. An en-dash/em-dash in the artist's name, i.e. Eagle‐Eye Cherry :

Sent URL(This isn't pasting correcting into Github) : https://www.last.fm/music/Eagle%E2%80%90Eye+Cherry
Correct URL: https://www.last.fm/music/Eagle-Eye+Cherry

  1. An apostrophe in the artist's name, i.e. Destiny’s Child :

Sent URL(This isn't pasting correcting into Github): https://www.last.fm/music/+noredirect/Destiny%E2%80%99S+Child Correct url: https://www.last.fm/music/Destiny's+Child or https://www.last.fm/music/Destiny%27s+Child

  1. Certain Artists with initials and periods, i.e. D.J. Jazzy Jeff & The Fresh Prince :

Sent URL: https://www.last.fm/music/+noredirect/D.J.+Jazzy+Jeff+&+the+Fresh+Prince Correct URL: https://www.last.fm/music/DJ+Jazzy+Jeff+&+The+Fresh+Prince

  1. Certain Artists with Foreign Names, i.e. Cédric Gervais :

Sent URL: https://www.last.fm/music/C%C3%A9dric+Gervais Correct URL: https://www.last.fm/music/Cedric+Gervais

sentriz commented 4 months ago

hm i definitely dont seem to have this issue. where are you getting the "Sent URL" links that you posted?

image image image image

sentriz commented 4 months ago

ah i see what the issue is, for example taking Destiny’s Child, the apostropy is a right single quotation mark (0x2019), if we visit that page (and prevent the auto redirect) you can see there is indeed no art for that artist

https://www.last.fm/music/+noredirect/Destiny%E2%80%99s+Child

the correct artist name is with a normal apostrophe (0x27)

https://www.last.fm/music/Destiny%27s+Child

maybe gonic could try follow those redirects

sentriz commented 4 months ago

seems to work now with https://github.com/sentriz/gonic/commit/2878b88aeee8bdf7a2e45520298422b883d8ab24

this will be availble in the docker :nightly image which builds in a few hours

to clear your local artist info cache for relevant entries try

$ sqlite3 path/to/gonic/gonic.db "delete from artist_infos where id in (select id from artists where name like '%‐%' or name like '%’%' or name like '%“%')"

and also delete your gonic cover cache dir

image

flkdnt commented 4 months ago

Thank you @sentriz!