Vote #77953
完了Validate length of string fields
0%
説明
Databases throw errors when trying to save data that doesn't fit in the allotted space in the field (MySQL used to not do that and just silently drop the part that was over the length of the field, but does throw errors in strict mode), which cause Redmine to crash.
The coming patch adds length validations for most fields a user can directly write to and that is a string (i.e. ist a VARCHAR in MySQL)
journals
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Committed, thanks.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
> validates_length_of :regexp, maximum: 30
custom_fields.regexp is varchar(255).
It must be maximum: 255.
--------------------------------------------------------------------------------
Yui Naruse wrote:
> > validates_length_of :regexp, maximum: 30
>
> custom_fields.regexp is varchar(255).
> It must be maximum: 255.
Thank you for pointing it out.
Reopening this issue.
<pre><code class="diff">
Index: app/models/custom_field.rb
===================================================================
--- app/models/custom_field.rb (revision 16111)
+++ app/models/custom_field.rb (working copy)
@@ -32,7 +32,7 @@
validates_presence_of :name, :field_format
validates_uniqueness_of :name, :scope => :type
validates_length_of :name, :maximum => 30
- validates_length_of :regexp, maximum: 30
+ validates_length_of :regexp, maximum: 255
validates_inclusion_of :field_format, :in => Proc.new { Redmine::FieldFormat.available_formats }
validate :validate_custom_field
attr_protected :id
</code></pre>
--------------------------------------------------------------------------------
Committed, thanks.
--------------------------------------------------------------------------------
Admin Redmine さんが3年以上前に更新
- カテゴリ を Code cleanup/refactoring_30 にセット
- 対象バージョン を 3.2.5_124 にセット