fat_free_crm
fat_free_crm copied to clipboard
Entering very long url into linkedin field creates DB error
(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.
Fixed in #784
validates_length_of :linkedin, maximum: 128