mirror of
https://github.com/redmine/redmine.git
synced 2026-04-02 02:31:17 +02:00
Projects with the identifiers "autocomplete" or "bulk_destroy" cannot perform some operations (#43910).
Patch by Go MAEDA (user:maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@24549 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -86,7 +86,9 @@ class Project < ApplicationRecord
|
||||
validates_format_of :identifier, :with => /\A(?!\d+$)[a-z0-9\-_]*\z/,
|
||||
:if => proc {|p| p.identifier_changed?}
|
||||
# reserved words
|
||||
validates_exclusion_of :identifier, :in => %w(new)
|
||||
validates_exclusion_of :identifier,
|
||||
:in => %w(new autocomplete bulk_destroy),
|
||||
:if => -> { new_record? || will_save_change_to_identifier? }
|
||||
validate :validate_parent
|
||||
|
||||
after_update :update_versions_from_hierarchy_change,
|
||||
|
||||
@@ -96,6 +96,8 @@ class ProjectTest < ActiveSupport::TestCase
|
||||
"ab-12" => true,
|
||||
"ab_12" => true,
|
||||
"12" => false,
|
||||
"autocomplete" => false,
|
||||
'bulk_destroy' => false,
|
||||
"new" => false}
|
||||
|
||||
to_test.each do |identifier, valid|
|
||||
|
||||
Reference in New Issue
Block a user