Commit 8272e18e57fd93e9adac789353a5b3640d781041

Authored by Dmitriy Zaporozhets
1 parent 37e39e41

Project path validation: array of not allowed paths

Showing 1 changed file with 4 additions and 2 deletions   Show diff stats
app/models/project.rb
... ... @@ -104,8 +104,10 @@ class Project < ActiveRecord::Base
104 104 end
105 105  
106 106 def repo_name
107   - if path == "gitolite-admin"
108   - errors.add(:path, " like 'gitolite-admin' is not allowed")
  107 + denied_paths = %w(gitolite-admin groups projects dashboard)
  108 +
  109 + if denied_paths.include?(path)
  110 + errors.add(:path, "like #{path} is not allowed")
109 111 end
110 112 end
111 113  
... ...