From: olav%bkor.dhs.org <> Date: Fri, 20 Oct 2006 23:56:25 +0000 (+0000) Subject: Bug 357005: 'cf_' should not be allowed as a custom field name X-Git-Tag: bugzilla-2.23.4~269 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2f38f17cfa3aad8a13ee6eb02944b52d9e79037;p=thirdparty%2Fbugzilla.git Bug 357005: 'cf_' should not be allowed as a custom field name Patch by Olav Vitters r=LpSolit a=myk --- diff --git a/editfields.cgi b/editfields.cgi index a77aafe772..f7a0590163 100644 --- a/editfields.cgi +++ b/editfields.cgi @@ -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; diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index bd3f29e114..eebefa9270 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -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" %]