Commit 926f3013c25645543fb1c91f7346585fdcb7a3a6

Authored by Jeremy Mack
1 parent 822c0a50

Updated validations and routes to support dots in project names

Showing 2 changed files with 5 additions and 5 deletions   Show diff stats
app/models/project.rb
... ... @@ -25,7 +25,7 @@ class Project < ActiveRecord::Base
25 25 validates :path,
26 26 :uniqueness => true,
27 27 :presence => true,
28   - :format => { :with => /^[a-zA-Z0-9_\-]*$/,
  28 + :format => { :with => /^[a-zA-Z0-9_\-\.]*$/,
29 29 :message => "only letters, digits & '_' '-' allowed" },
30 30 :length => { :within => 0..255 }
31 31  
... ... @@ -35,7 +35,7 @@ class Project < ActiveRecord::Base
35 35 validates :code,
36 36 :presence => true,
37 37 :uniqueness => true,
38   - :format => { :with => /^[a-zA-Z0-9_\-]*$/,
  38 + :format => { :with => /^[a-zA-Z0-9_\-\.]*$/,
39 39 :message => "only letters, digits & '_' '-' allowed" },
40 40 :length => { :within => 3..255 }
41 41  
... ...
config/routes.rb
... ... @@ -6,7 +6,7 @@ Gitlab::Application.routes.draw do
6 6  
7 7 namespace :admin do
8 8 resources :users
9   - resources :projects
  9 + resources :projects, :constraints => { :id => /[^\/]+/ }
10 10 resources :team_members
11 11 get 'emails', :to => 'mailer#preview'
12 12 get 'mailer/preview_note'
... ... @@ -28,12 +28,12 @@ Gitlab::Application.routes.draw do
28 28  
29 29 #get "profile/:id", :to => "profile#show"
30 30  
31   - resources :projects, :only => [:new, :create, :index]
  31 + resources :projects, :constraints => { :id => /[^\/]+/ }, :only => [:new, :create, :index]
32 32 resources :keys
33 33  
34 34 devise_for :users
35 35  
36   - resources :projects, :except => [:new, :create, :index], :path => "/" do
  36 + resources :projects, :constraints => { :id => /[^\/]+/ }, :except => [:new, :create, :index], :path => "/" do
37 37 member do
38 38 get "team"
39 39 get "wall"
... ...