Fix #5140: Unexpected error: PublicSuffix::DomainInvalid for searching some newgrounds urls in /artists

When the artist name couldn't found for a Newgrounds URL, for example
for `https://www.newgrounds.com/dump/item`, then the `profile_url`
method erroneously returned `https://.newgrounds.com`. This led to an
error later on when the artist finder tried to parse the invalid URL.

Also fix `strategy_should_work` to test that the profile URL is a valid
URL, and not to try to download the file when image_urls is empty.
This commit is contained in:
evazion
2022-04-22 23:05:47 -05:00
parent db6bb2ccac
commit 76d9e86724
4 changed files with 22 additions and 2 deletions

View File

@@ -60,7 +60,7 @@ module Source
def profile_url
# user names are not mutable, artist names are.
# However we need the latest name for normalization
"https://#{artist_name}.newgrounds.com"
"https://#{artist_name}.newgrounds.com" if artist_name.present?
end
def artist_commentary_title