summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Bug.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2008-01-13 00:20:50 +0100
committerlpsolit%gmail.com <>2008-01-13 00:20:50 +0100
commit0e2ea68e886628033f9afeba99f90144b4f85510 (patch)
treebdb26475965046e8680130ad0daf42d1d315416a /Bugzilla/Bug.pm
parenta404e6c3e3d777f09ef2ab8100ad01a20a3c885c (diff)
downloadbugzilla-0e2ea68e886628033f9afeba99f90144b4f85510.tar.gz
bugzilla-0e2ea68e886628033f9afeba99f90144b4f85510.tar.xz
Bug 411437: Clipping of "Free Text" fields when user enters more then 255 characters - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
Diffstat (limited to 'Bugzilla/Bug.pm')
-rwxr-xr-xBugzilla/Bug.pm19
1 files changed, 16 insertions, 3 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index e9274466d..28752da46 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -148,9 +148,12 @@ sub VALIDATORS {
elsif ($field->type == FIELD_TYPE_DATETIME) {
$validator = \&_check_datetime_field;
}
- else {
+ elsif ($field->type == FIELD_TYPE_FREETEXT) {
$validator = \&_check_freetext_field;
}
+ else {
+ $validator = \&_check_default_field;
+ }
$validators->{$field->name} = $validator;
}
@@ -1074,8 +1077,6 @@ sub _check_estimated_time {
return $_[0]->_check_time($_[1], 'estimated_time');
}
-sub _check_freetext_field { return defined $_[1] ? trim($_[1]) : ''; }
-
sub _check_groups {
my ($invocant, $product, $group_ids) = @_;
@@ -1373,6 +1374,18 @@ sub _check_datetime_field {
return $date_time
}
+sub _check_default_field { return defined $_[1] ? trim($_[1]) : ''; }
+
+sub _check_freetext_field {
+ my ($invocant, $text) = @_;
+
+ $text = (defined $text) ? trim($text) : '';
+ if (length($text) > MAX_FREETEXT_LENGTH) {
+ ThrowUserError('freetext_too_long', { text => $text });
+ }
+ return $text;
+}
+
sub _check_multi_select_field {
my ($invocant, $values, $field) = @_;
return [] if !$values;