diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2017-05-30 21:29:55 +0300 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2017-05-30 21:29:55 +0300 |
commit | deba648e38851ce0b24df94d6d24f083af0ffad4 (patch) | |
tree | ddc03683d07704cd5ff539c37a74f1a9ce3388f4 /app | |
parent | f6ba1e081c96bd0a8c3561d92f97aa11d6688bc5 (diff) |
Revert "Merge remote-tracking branch 'dev/security-9-0' into 9-0-stable"
This reverts commit f6ba1e081c96bd0a8c3561d92f97aa11d6688bc5, reversing
changes made to 810cc51be37e03ebbe99711a53663956e4ffde8c.
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 a71fbb91f42..d7a45bacd35 100644 --- a/app/controllers/autocomplete_controller.rb +++ b/app/controllers/autocomplete_controller.rb @@ -22,7 +22,7 @@ class AutocompleteController < ApplicationController @users = [current_user, *@users] 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 158d13e8ef6..d6ccf0dc92c 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) |