diff options
author | Claire <claire.github-309c@sitedethib.com> | 2023-01-05 13:33:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-05 13:33:33 +0100 |
commit | 3654c945832405267e80fe24b14f7e1d74c395ba (patch) | |
tree | f3b1a1c11eae7551e0d2a4862f4d99c92cf18cb5 /app/models | |
parent | b3ab0014e669e25b984dc7e769a2d1e6d2736ef0 (diff) |
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
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/relay.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/relay.rb b/app/models/relay.rb index d6ddd30ed..c66bfe4ff 100644 --- a/app/models/relay.rb +++ b/app/models/relay.rb @@ -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 |