diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/1_settings.rb | 6 | ||||
-rw-r--r-- | config/initializers/active_record_data_types.rb | 2 | ||||
-rw-r--r-- | config/routes/admin.rb | 2 | ||||
-rw-r--r-- | config/routes/group.rb | 4 | ||||
-rw-r--r-- | config/routes/project.rb | 10 | ||||
-rw-r--r-- | config/routes/uploads.rb | 10 |
6 files changed, 17 insertions, 17 deletions
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 899e612ffbd..5b4e6b5db88 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -110,7 +110,7 @@ class Settings < Settingslogic url = "http://#{url}" unless url.start_with?('http') # Get rid of the path so that we don't even have to encode it - url_without_path = url.sub(%r{(https?://[^\/]+)/?.*}, '\1') + url_without_path = url.sub(%r{(https?://[^/]+)/?.*}, '\1') URI.parse(url_without_path).host end @@ -469,10 +469,10 @@ end # repository_downloads_path value. # repositories_storages = Settings.repositories.storages.values -repository_downloads_path = Settings.gitlab['repository_downloads_path'].to_s.gsub(/\/$/, '') +repository_downloads_path = Settings.gitlab['repository_downloads_path'].to_s.gsub(%r{/$}, '') repository_downloads_full_path = File.expand_path(repository_downloads_path, Settings.gitlab['user_home']) -if repository_downloads_path.blank? || repositories_storages.any? { |rs| [repository_downloads_path, repository_downloads_full_path].include?(rs['path'].gsub(/\/$/, '')) } +if repository_downloads_path.blank? || repositories_storages.any? { |rs| [repository_downloads_path, repository_downloads_full_path].include?(rs['path'].gsub(%r{/$}, '')) } Settings.gitlab['repository_downloads_path'] = File.join(Settings.shared['path'], 'cache/archive') end diff --git a/config/initializers/active_record_data_types.rb b/config/initializers/active_record_data_types.rb index 0359e14b232..fda13d0c4cb 100644 --- a/config/initializers/active_record_data_types.rb +++ b/config/initializers/active_record_data_types.rb @@ -54,7 +54,7 @@ elsif Gitlab::Database.mysql? def initialize_type_map(mapping) super mapping - mapping.register_type(%r(timestamp)i) do |sql_type| + mapping.register_type(/timestamp/i) do |sql_type| precision = extract_precision(sql_type) ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlDateTimeWithTimeZone.new(precision: precision) end diff --git a/config/routes/admin.rb b/config/routes/admin.rb index 57e401c9b89..3cca1210e39 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -1,5 +1,5 @@ namespace :admin do - resources :users, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do + resources :users, constraints: { id: %r{[a-zA-Z./0-9_\-]+} } do resources :keys, only: [:show, :destroy] resources :identities, except: [:show] resources :impersonation_tokens, only: [:index, :create] do diff --git a/config/routes/group.rb b/config/routes/group.rb index 976837a246d..24c76bc55ab 100644 --- a/config/routes/group.rb +++ b/config/routes/group.rb @@ -35,7 +35,7 @@ constraints(GroupUrlConstrainer.new) do post :toggle_subscription, on: :member end - resources :milestones, constraints: { id: /[^\/]+/ }, only: [:index, :show, :edit, :update, :new, :create] do + resources :milestones, constraints: { id: %r{[^/]+} }, only: [:index, :show, :edit, :update, :new, :create] do member do get :merge_requests get :participants @@ -52,7 +52,7 @@ constraints(GroupUrlConstrainer.new) do resources :uploads, only: [:create] do collection do - get ":secret/:filename", action: :show, as: :show, constraints: { filename: /[^\/]+/ } + get ":secret/:filename", action: :show, as: :show, constraints: { filename: %r{[^/]+} } end end end diff --git a/config/routes/project.rb b/config/routes/project.rb index 0496bd85b4e..bcaa68c8ce5 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -40,7 +40,7 @@ constraints(ProjectUrlConstrainer.new) do # # Templates # - get '/templates/:template_type/:key' => 'templates#show', as: :template, constraints: { key: /[^\/]+/ } + get '/templates/:template_type/:key' => 'templates#show', as: :template, constraints: { key: %r{[^/]+} } resource :avatar, only: [:show, :destroy] resources :commit, only: [:show], constraints: { id: /\h{7,40}/ } do @@ -55,7 +55,7 @@ constraints(ProjectUrlConstrainer.new) do end resource :pages, only: [:show, :destroy] do - resources :domains, only: [:show, :new, :create, :destroy], controller: 'pages_domains', constraints: { id: /[^\/]+/ } + resources :domains, only: [:show, :new, :create, :destroy], controller: 'pages_domains', constraints: { id: %r{[^/]+} } end resources :snippets, concerns: :awardable, constraints: { id: /\d+/ } do @@ -65,7 +65,7 @@ constraints(ProjectUrlConstrainer.new) do end end - resources :services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do + resources :services, constraints: { id: %r{[^/]+} }, only: [:index, :edit, :update] do member do put :test end @@ -346,7 +346,7 @@ constraints(ProjectUrlConstrainer.new) do end end - resources :project_members, except: [:show, :new, :edit], constraints: { id: /[a-zA-Z.\/0-9_\-#%+]+/ }, concerns: :access_requestable do + resources :project_members, except: [:show, :new, :edit], constraints: { id: %r{[a-zA-Z./0-9_\-#%+]+} }, concerns: :access_requestable do collection do delete :leave @@ -379,7 +379,7 @@ constraints(ProjectUrlConstrainer.new) do resources :uploads, only: [:create] do collection do - get ":secret/:filename", action: :show, as: :show, constraints: { filename: /[^\/]+/ } + get ":secret/:filename", action: :show, as: :show, constraints: { filename: %r{[^/]+} } end end diff --git a/config/routes/uploads.rb b/config/routes/uploads.rb index d7bca8310e4..6370645bcb9 100644 --- a/config/routes/uploads.rb +++ b/config/routes/uploads.rb @@ -2,17 +2,17 @@ scope path: :uploads do # Note attachments and User/Group/Project avatars get "-/system/:model/:mounted_as/:id/:filename", to: "uploads#show", - constraints: { model: /note|user|group|project/, mounted_as: /avatar|attachment/, filename: /[^\/]+/ } + constraints: { model: /note|user|group|project/, mounted_as: /avatar|attachment/, filename: %r{[^/]+} } # show uploads for models, snippets (notes) available for now get '-/system/:model/:id/:secret/:filename', to: 'uploads#show', - constraints: { model: /personal_snippet/, id: /\d+/, filename: /[^\/]+/ } + constraints: { model: /personal_snippet/, id: /\d+/, filename: %r{[^/]+} } # show temporary uploads get '-/system/temp/:secret/:filename', to: 'uploads#show', - constraints: { filename: /[^\/]+/ } + constraints: { filename: %r{[^/]+} } # Appearance get "-/system/:model/:mounted_as/:id/:filename", @@ -22,7 +22,7 @@ scope path: :uploads do # Project markdown uploads get ":namespace_id/:project_id/:secret/:filename", to: "projects/uploads#show", - constraints: { namespace_id: /[a-zA-Z.0-9_\-]+/, project_id: /[a-zA-Z.0-9_\-]+/, filename: /[^\/]+/ } + constraints: { namespace_id: /[a-zA-Z.0-9_\-]+/, project_id: /[a-zA-Z.0-9_\-]+/, filename: %r{[^/]+} } # create uploads for models, snippets (notes) available for now post ':model', @@ -34,4 +34,4 @@ end # Redirect old note attachments path to new uploads path. get "files/note/:id/:filename", to: redirect("uploads/note/attachment/%{id}/%{filename}"), - constraints: { filename: /[^\/]+/ } + constraints: { filename: %r{[^/]+} } |