artists: fix artist finder returning wrong results when given nil url.

Fix the artist finder returning incorrect results when given a nil URL.
This only happened when an artist with a URL like this existed:

    http:///blog.naver.com/dan_rak

Note the triple `///`; the extra `/` messed up the artist finder.

The artist finder may be given a nil URL when a source strategy returns
a nil profile URL, usually because the source is bad_id.
This commit is contained in:
evazion
2022-03-18 05:54:44 -05:00
parent 42144eaa4b
commit 03d2098d6d
2 changed files with 3 additions and 1 deletions

View File

@@ -154,6 +154,8 @@ module ArtistFinder
# @param url [String] the artist profile URL
# @return [Array<Artist>] the list of matching artists
def find_artists(url)
return Artist.none if url.blank?
url = ArtistURL.normalize_normalized_url(url)
# First try an exact match

View File

@@ -145,7 +145,7 @@ module Sources
end
def artists
ArtistFinder.find_artists(profile_url.to_s)
ArtistFinder.find_artists(profile_url)
end
# A new artist entry with suggested defaults for when the artist doesn't