Strip spaces around URL when adding a relay (#22655)
* Strip spaces around URL when adding a relay Fixes #22650 * Gracefuly handle URL parsing errors in URL validator
This commit is contained in:
@@ -18,6 +18,7 @@ class Relay < ApplicationRecord
|
||||
|
||||
scope :enabled, -> { accepted }
|
||||
|
||||
before_validation :strip_url
|
||||
before_destroy :ensure_disabled
|
||||
|
||||
alias enabled? accepted?
|
||||
@@ -74,4 +75,8 @@ class Relay < ApplicationRecord
|
||||
def ensure_disabled
|
||||
disable! if enabled?
|
||||
end
|
||||
|
||||
def strip_url
|
||||
inbox_url&.strip!
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user