diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2017-05-30 18:30:42 +0000 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2017-05-30 18:30:42 +0000 |
commit | 200e8582f8fc0c7949f052673b25e1aff1490f7e (patch) | |
tree | 085a42789ff5b29df4e07aff46a14055f469c5d2 /app | |
parent | cc1b069ff9bfee3374b005e588b03de10afba689 (diff) | |
download | gitlab-ce-200e8582f8fc0c7949f052673b25e1aff1490f7e.tar.gz |
Revert "Merge remote-tracking branch 'dev/security-9-1' into 9-1-stable"
This reverts commit cc1b069ff9bfee3374b005e588b03de10afba689, reversing
changes made to 729c75f700b75ea7b67e61ab01694f9d12623af1.
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/autocomplete_controller.rb | 2 | ||||
-rw-r--r-- | app/uploaders/file_uploader.rb | 7 | ||||
-rw-r--r-- | app/uploaders/gitlab_uploader.rb | 20 | ||||
-rw-r--r-- | app/validators/namespace_validator.rb | 5 | ||||
-rw-r--r-- | app/validators/project_path_validator.rb | 2 |
5 files changed, 8 insertions, 28 deletions
diff --git a/app/controllers/autocomplete_controller.rb b/app/controllers/autocomplete_controller.rb index f94f88305a4..b79ca034c5b 100644 --- a/app/controllers/autocomplete_controller.rb +++ b/app/controllers/autocomplete_controller.rb @@ -21,7 +21,7 @@ class AutocompleteController < ApplicationController @users = [current_user, *@users].uniq end - if params[:author_id].present? && current_user + if params[:author_id].present? author = User.find_by_id(params[:author_id]) @users = [author, *@users].uniq if author end diff --git a/app/uploaders/file_uploader.rb b/app/uploaders/file_uploader.rb index 953feb9b9e8..d2783ce5b2f 100644 --- a/app/uploaders/file_uploader.rb +++ b/app/uploaders/file_uploader.rb @@ -13,13 +13,6 @@ class FileUploader < GitlabUploader ) end - # Not using `GitlabUploader.base_dir` because all project namespaces are in - # the `public/uploads` dir. - # - def self.base_dir - root_dir - end - # Returns the part of `store_dir` that can change based on the model's current # path # diff --git a/app/uploaders/gitlab_uploader.rb b/app/uploaders/gitlab_uploader.rb index 78e9580661b..d662ba6820c 100644 --- a/app/uploaders/gitlab_uploader.rb +++ b/app/uploaders/gitlab_uploader.rb @@ -3,28 +3,16 @@ class GitlabUploader < CarrierWave::Uploader::Base File.join(CarrierWave.root, upload_record.path) end - def self.root_dir + def self.base_dir 'uploads' end - # When object storage is used, keep the `root_dir` as `base_dir`. - # The files aren't really in folders there, they just have a name. - # The files that contain user input in their name, also contain a hash, so - # the names are still unique - # - # This method is overridden in the `FileUploader` - def self.base_dir - return root_dir unless file_storage? - - File.join(root_dir, 'system') - end + delegate :base_dir, to: :class - def self.file_storage? - self.storage == CarrierWave::Storage::File + def file_storage? + self.class.storage == CarrierWave::Storage::File end - delegate :base_dir, :file_storage?, to: :class - # Reduce disk IO def move_to_cache true diff --git a/app/validators/namespace_validator.rb b/app/validators/namespace_validator.rb index 0a1656d867a..77ca033e97f 100644 --- a/app/validators/namespace_validator.rb +++ b/app/validators/namespace_validator.rb @@ -33,7 +33,6 @@ class NamespaceValidator < ActiveModel::EachValidator u unsubscribes users - system ].freeze WILDCARD_ROUTES = %w[tree commits wikis new edit create update logs_tree @@ -48,9 +47,9 @@ class NamespaceValidator < ActiveModel::EachValidator def self.reserved?(value, strict: false) if strict - STRICT_RESERVED.include?(value.to_s.downcase) + STRICT_RESERVED.include?(value) else - RESERVED.include?(value.to_s.downcase) + RESERVED.include?(value) end end diff --git a/app/validators/project_path_validator.rb b/app/validators/project_path_validator.rb index eeee7f8aada..ee2ae65be7b 100644 --- a/app/validators/project_path_validator.rb +++ b/app/validators/project_path_validator.rb @@ -15,7 +15,7 @@ class ProjectPathValidator < ActiveModel::EachValidator # 'tree' as project name and 'deploy_keys' as route. # RESERVED = (NamespaceValidator::STRICT_RESERVED - - %w[dashboard help ci admin search notes services assets profile public system]).freeze + %w[dashboard help ci admin search notes services assets profile public]).freeze def self.valid?(value) !reserved?(value) |