mirror of
https://github.com/discourse/discourse.git
synced 2025-05-03 18:34:42 +08:00
FIX: users with invalid website in profile get 422 error when viewing topics and other routes
This commit is contained in:
parent
a4a01d4122
commit
cb8abd09a9
@ -4,7 +4,7 @@ class UserProfile < ActiveRecord::Base
|
|||||||
WEBSITE_REGEXP = /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,9}(([0-9]{1,5})?\/.*)?$)/ix
|
WEBSITE_REGEXP = /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,9}(([0-9]{1,5})?\/.*)?$)/ix
|
||||||
|
|
||||||
validates :bio_raw, length: { maximum: 3000 }
|
validates :bio_raw, length: { maximum: 3000 }
|
||||||
validates :website, format: { with: WEBSITE_REGEXP }, allow_blank: true
|
validates :website, format: { with: WEBSITE_REGEXP }, allow_blank: true, if: Proc.new { |c| c.new_record? || c.website_changed? }
|
||||||
validates :user, presence: true
|
validates :user, presence: true
|
||||||
before_save :cook
|
before_save :cook
|
||||||
after_save :trigger_badges
|
after_save :trigger_badges
|
||||||
|
Loading…
x
Reference in New Issue
Block a user