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:
@@ -154,6 +154,8 @@ module ArtistFinder
|
|||||||
# @param url [String] the artist profile URL
|
# @param url [String] the artist profile URL
|
||||||
# @return [Array<Artist>] the list of matching artists
|
# @return [Array<Artist>] the list of matching artists
|
||||||
def find_artists(url)
|
def find_artists(url)
|
||||||
|
return Artist.none if url.blank?
|
||||||
|
|
||||||
url = ArtistURL.normalize_normalized_url(url)
|
url = ArtistURL.normalize_normalized_url(url)
|
||||||
|
|
||||||
# First try an exact match
|
# First try an exact match
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ module Sources
|
|||||||
end
|
end
|
||||||
|
|
||||||
def artists
|
def artists
|
||||||
ArtistFinder.find_artists(profile_url.to_s)
|
ArtistFinder.find_artists(profile_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
# A new artist entry with suggested defaults for when the artist doesn't
|
# A new artist entry with suggested defaults for when the artist doesn't
|
||||||
|
|||||||
Reference in New Issue
Block a user