summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authormkanat%kerio.com <>2005-03-07 22:55:33 +0100
committermkanat%kerio.com <>2005-03-07 22:55:33 +0100
commit5f042e841a435995e62f0cc8e8c4e9bd9f2c9c15 (patch)
tree38a093e9be57478dd7c4be58d53101de0c69484a /Bugzilla
parent494f0e59486cbabfd02aa9a8f410f4e00861f62b (diff)
downloadbugzilla-5f042e841a435995e62f0cc8e8c4e9bd9f2c9c15.tar.gz
bugzilla-5f042e841a435995e62f0cc8e8c4e9bd9f2c9c15.tar.xz
Bug 283924: Move ValidateComment out of CGI.pl
Patch By Max Kanat-Alexander <mkanat@kerio.com> r=LpSolit, a=justdave
Diffstat (limited to 'Bugzilla')
-rwxr-xr-xBugzilla/Bug.pm15
1 files changed, 15 insertions, 0 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index b2261e1ee..b9229d98e 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -44,6 +44,13 @@ use Bugzilla::User;
use Bugzilla::Util;
use Bugzilla::Error;
+use base qw(Exporter);
+@Bugzilla::Bug::EXPORT = qw(
+ ValidateComment
+);
+
+use constant MAX_COMMENT_LENGTH => 65535;
+
sub fields {
# Keep this ordering in sync with bugzilla.dtd
my @fields = qw(bug_id alias creation_ts short_desc delta_ts
@@ -585,6 +592,14 @@ sub CountOpenDependencies {
return @dependencies;
}
+sub ValidateComment ($) {
+ my ($comment) = @_;
+
+ if (defined($comment) && length($comment) > MAX_COMMENT_LENGTH) {
+ ThrowUserError("comment_too_long");
+ }
+}
+
sub AUTOLOAD {
use vars qw($AUTOLOAD);
my $attr = $AUTOLOAD;