fat_free_crm icon indicating copy to clipboard operation
fat_free_crm copied to clipboard

Entering very long url into linkedin field creates DB error

Open steveyken opened this issue 9 years ago • 1 comments

(this occurs on Postgres DB, haven't checked the mysql or sqllite)

  • edit a contact
  • enter a very long link into Linked In field
  • press submit

DB error is thrown:

ActiveRecord::StatementInvalid (PG::StringDataRightTruncation: ERROR:  value too long for type character varying(128)
 : UPDATE "contacts" SET "department" = $1, "fax" = $2, "linkedin" = $3, "skype" = $4, "updated_at" = $5 WHERE "contacts"."id" = $6):
app/models/entities/contact.rb:134:in `update_with_account_and_permissions'
app/controllers/entities/contacts_controller.rb:86:in `block in update'
app/controllers/entities/contacts_controller.rb:85:in `update'

Fields like this should be validated properly in Rails with maxlength as appropriate.

steveyken avatar Jun 19 '15 04:06 steveyken

Fixed in #784

validates_length_of :linkedin, maximum: 128

CloCkWeRX avatar May 04 '21 03:05 CloCkWeRX