artists: fix validation error when url_string has leading spaces.
Bug: if the url_string had leading spaces, when it was split the resulting array contained the empty string, which led to a validation error when trying to save the urls. Fixup for #3247.
This commit is contained in:
@@ -67,7 +67,7 @@ class Artist < ApplicationRecord
|
||||
def url_string=(string)
|
||||
@url_string_was = url_string
|
||||
|
||||
self.urls = string.split(/[[:space:]]+/).uniq.map do |url|
|
||||
self.urls = string.scan(/[^[:space:]]+/).uniq.map do |url|
|
||||
self.urls.find_or_initialize_by(url: url)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user