Bug 357005: 'cf_' should not be allowed as a custom field name

Patch by Olav Vitters <olav@bkor.dhs.org> r=LpSolit a=myk


git-svn-id: svn://10.0.0.236/trunk@213917 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
olav%bkor.dhs.org 2006-10-20 16:56:25 +00:00
parent 9123e63bfc
commit 03b7d34b84
2 changed files with 4 additions and 3 deletions

View File

@ -63,8 +63,8 @@ elsif ($action eq 'new') {
# Validate these fields.
$name || ThrowUserError('customfield_missing_name');
# Don't want to allow a name that might mess up SQL.
$name =~ /^\w+$/ || ThrowUserError('customfield_invalid_name',
{ name => $name });
$name =~ /^\w+$/ && $name ne "cf_"
|| ThrowUserError('customfield_invalid_name', { name => $name });
# Prepend cf_ to the custom field name to distinguish it from standard fields.
if ($name !~ /^cf_/) {
$name = 'cf_' . $name;

View File

@ -319,7 +319,8 @@
[% ELSIF error == "customfield_invalid_name" %]
[% title = "Invalid Custom Field Name" %]
'[% name FILTER html %]' is not a valid name for a custom field.
A name may contain only letters, numbers, and the underscore character.
A name may contain only letters, numbers, and the underscore character. The
name should also be different from 'cf_'.
[% ELSIF error == "customfield_nonexistent" %]
[% title = "Unknown Custom Field" %]