AddField("logincookies", "ipaddr", "varchar(40) NOT NULL");
}
+# Fixup for Bug 101380
+# "Newlines, nulls, leading/trailing spaces are getting into summaries"
+
+my $controlchar_bugs =
+ $dbh->selectall_arrayref("SELECT short_desc, bug_id FROM bugs WHERE " .
+ "'short_desc' REGEXP '[[:cntrl:]]'");
+if (@$controlchar_bugs)
+{
+ print 'Cleaning control characters from bug summaries...';
+ foreach (@$controlchar_bugs) {
+ my ($short_desc, $bug_id) = @$_;
+ print " $bug_id...";
+ $short_desc = clean_text($short_desc);
+ $dbh->do("UPDATE bugs SET short_desc = ? WHERE bug_id = ?",
+ undef, $short_desc, $bug_id);
+ }
+ print " done.\n";
+}
+
# If you had to change the --TABLE-- definition in any way, then add your
# differential change code *** A B O V E *** this comment.
#
return $str;
}
+sub clean_text {
+ my ($dtext) = shift;
+ $dtext =~ s/[\x00-\x1F\x7F]+/ /g; # change control characters to spaces
+ return trim($dtext);
+}
+
###############################################################################
# Global Templatization Code
exit;
}
-if (!defined $::FORM{'short_desc'} || trim($::FORM{'short_desc'}) eq "") {
+$::FORM{'short_desc'} = clean_text($::FORM{'short_desc'});
+if (!defined $::FORM{'short_desc'} || $::FORM{'short_desc'} eq "") {
DisplayError("You must enter a summary for this bug.");
exit;
}
CheckFormFieldDefined(\%::FORM, 'target_milestone');
}
+$::FORM{'short_desc'} = clean_text($::FORM{'short_desc'});
+
#
# This function checks if there is a comment required for a specific
# function and tests, if the comment was given.